[R] Passing additional arguments through '...'

escher2079 aluedtke at upenn.edu
Fri Jul 17 15:46:36 CEST 2009


Thanks everyone for your suggestions, they've been very helpful. I think I've
just about solved my problem, but not quite yet. As suggested, I've used
sys.call and match.call. Here is what I have so far:

fun.tester <- function(abc,def,ghi,jkl,...){
 mf <- match.call(expand.dots = FALSE)
 sc <- sys.call()
 nmf <- names(mf)[-1]
 nmf <- nmf[-length(nmf)]
 nsc <- names(sc)[-(1:(length(nmf)+1))]
 nmf[(length(nmf)+1):(length(nmf)+length(nsc))]<-nsc
 lsc <- as.list(sc)[-1]
 list(nmf,lsc)
}

So I have the variable names in the order they were put in (as long as the
additional arguments are put in last), and the values in the order in which
they were put in as well. The last thing I need to do is to assign the
values in lsc into the variables identified by the string values in nmf.
Unfortunately, I haven't been able to work this part out. Any suggestions?
-- 
View this message in context: http://www.nabble.com/Passing-additional-arguments-through-%27...%27-tp24501159p24534723.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list