[R] call a function with explicitly not setting an argument

jeroen00ms jeroen.ooms at stat.ucla.edu
Sat Jul 23 15:31:12 CEST 2011


Is there a way to call a function, and explicitly set an argument to 'not
specified'? My situation is the following. I have a function which passes on
most of its arguments to another function. The second function, myfun2,
serializes all arguments and is out of my control. 

myfun <- function(...){
  return(myfun2(...));
}

now, the value for arguments of myfun are stored in variables. Say I want to
call it with arguments 'foo' and 'bar', which are stored in variables
'myfoo' and 'mybar'. So in my script I call

myfun(foo=myfoo, bar=mybar);

However, I also want to be able to call myfun2 without any arguments. Is
there any value that I can assign to myfoo and mybar, so that
myfun(foo=myfoo, bar=mybar); is identical to myfun();





--
View this message in context: http://r.789695.n4.nabble.com/call-a-function-with-explicitly-not-setting-an-argument-tp3688883p3688883.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list