[R] Dealing with an argument missing in ...

Christophe Genolini cgenolin at u-paris10.fr
Wed Mar 10 11:28:23 CET 2010


Hi the list

I define a S3 function that can have a various number of argument using 
'...'
When some arguments are missing, I would like to give them some default 
value:
 
func.numeric <- function(x,...){
   if(missing(y)){y<-3}
}
 
But it does not works...
 
I precise that I can not put 'y' explicitly in the argument list since 
func is an S3 function, I cannot change its arguments.
Any suggestions?
 
Thanks
Christophe



More information about the R-help mailing list