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

Vadim Kutsyy vadim at kutsyy.com
Mon Jun 26 21:22:55 CEST 2000


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 at 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 at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list