Skip to content
Prev 30379 / 398513 Next

How to count the number of parameters in a function

You can use list(...):

Myfunc<-function(...)
{
d<-list(...)
n<-length(d)
## Other instructions
return(n)
}

##  Example:

var1<-runif(20)
var2<-rnorm(20)
var3<-rpois(20, 2)
Myfunc(var1, var2, var3)

Hope this helps,

Clem.
At 08:55 09/04/2003 +0100, arnaud_amsellem at ssga.com wrote:
Message-ID: <5.1.0.14.0.20030409100628.00b1a678@biomserv.univ-lyon1.fr>
In-Reply-To: <OFAD99F2AA.8B9052DB-ON80256D03.002A9A0E@ssga.statestreet.c om>