Hi all,

Is there a way to modify the optional arguments (...) passed to a function, so that these can be passed in modified form to a subsequent function call? I checked "Programming with Data" but could not find a solution there.

What I'd like is something along these lines:

test <- function(x,y,...) {
  if(!hasArg(xlab)) { ___add xlab to ...___ }
  if(hasArg(xlab)) { ___remove xlab from ...___ }  # alternative

  plot(x,y,...)
}

Of course, I could use separate calls, like

if(hasArg(xlab)) plot(x,y,...) else plot(x,y,xlab="label",...)

but this gets complicated if there is more than one such case to consider.

Thanks

Pascal

--

Pascal A. Niklaus
Institute of Evolutionary Biology and Environmental Studies
University of Zurich
Winterthurerstrasse 190
CH-8057 Zurich / Switzerland

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to