[R] How to count the number of parameters in a function

Torsten Hothorn Torsten.Hothorn at rzmail.uni-erlangen.de
Wed Apr 9 10:15:05 CEST 2003


On Wed, 9 Apr 2003 arnaud_amsellem at ssga.com wrote:

> I have the following function:
> Myfunc <- function(var1,var2,.....,varN)
> { .....
> }
> In the above function I have a variable number of parameters (N>2). How can
> I count how many parameters have been entered?
>

using `lm' as example:

length(formals(lm))

best,

Torsten

> Any help appreciated
>
> Thanks
>
> Arno
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
>



More information about the R-help mailing list