[R-sig-teaching] count the number of argument of a functionr

Bob bob at statland.org
Tue Oct 20 22:32:03 CEST 2015


> 
> Dear All:
> 
> I am wondering whether there is a way to read and assign the number of
> arguments of a function inside this function.
> 
> 
> ### For example
> 
> fun<-function(x1,x2,x3,...){
> 
> m<- number of arguments
> 
> }
> 
> ### e.g.
> 
> fun<-function(x1,x2,x3){
> 
> m<- number of arguments
> 
> ### m =3 in this case
> 
> }
> 
> ### e.g.
> 
> fun<-function(x1,x2,x3,y1,z1,z2){
> 
> m<- number of arguments
> 
> ### m =6 in this case
> 
> }
> 
> 
> 
> 
> with thanks
> Steve
> 
> -- 
> Steven M. Stoline
> 1123 Forest Avenue
> Portland, ME 04112
> sstoline at gmail.com
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-teaching at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
> 
> 


------->  First-time AP Stats. teacher?  Help is on the way! See
http://courses.ncssm.edu/math/Stat_Inst/Stats2007/Bob%20Hayden/Relief.html
      _
     | |          Robert W. Hayden
     | |          614 Nashua Street #119
    /  |          Milford, New Hampshire 03055  USA
   |   |          
   |   |          email: bob@ the site below
  /  x |          website: http://statland.org
 |     /          
 ''''''



More information about the R-sig-teaching mailing list