[R] nargs() inside "[.myclass"

About this list Date view Thread view Subject view Author view Other groups

Subject: [R] nargs() inside "[.myclass"
From: Vadim Kutsyy (vadim@kutsyy.com)
Date: Tue 27 Jun 2000 - 05:22:55 EST


Message-ID: <OFEGJMACADMFOKHCCFBJGELDCIAA.vadim@kutsyy.com>

I am writing a function to work with class I am defining. I have a question
about using nargs() inside of parentheses function. nargs() shows the same
for supplying 1 argument, or no arguments at all. Here is a small example:

> "[.myclass"<-function(x,...) print(nargs()-1)
> x<-c(1,2,3)
> class(x)<-"myclass"
> x[]
[1] 1
> x[1]
[1] 1
> x[1,2]
[1] 2

how can I determine if there was 1 argument supplied, or none?

Thanks.

PS:
> version
         _
platform Windows
arch x86
os Win32
system x86, Win32
status
major 1
minor 0.1
year 2000
month April
day 14
language R

---------------------------
Vadim Kutsyy
vadim@kutsyy.com
http://www.kutsyy.com

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Mon 17 Jul 2000 - 12:33:24 EST