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

escher2079 aluedtke at upenn.edu
Fri Jul 17 18:14:28 CEST 2009


Fair enough. I'm not going to post all the code because it's distracting, but
the following example function is demonstrative of the problem:

exfun<-function(...){
 print(x)
}

I'm aware that leaving making the only inputs additional arguments is bad
form, but this is merely an example. So here if I call exfun as follows:

exfun(x=2)

I get "Error in print(x) : object 'x' not found". I guess this makes sense
since the additional arguments aren't really meant to be used like that, but
what I would like to know is how I would access the variable passed in the
additional arguments in exfun given that I know the name (which I can access
through sys.call). I hope that was helpful :/. Thanks!




Charles C. Berry wrote:
> 
> I did not follow that.
> 
> But I might guess that you do not grok what
> 
>  	mf <- eval(mf, parent.frame())
> 
> is doing in lm(). If so, then you _really_ need to spend some time working 
> that through before attempting a customized argument matching scheme.
> 
> In any case, the suggestion to "provide commented, minimal, 
> self-contained, reproducible code" is often helpful to folks who read this 
> list in showing what you intend and provides a basis for discussion - even 
> if your code is incomplete or doesn't do quite what you want it to do.
> 
> 
> HTH,
> 
> Chuck
> 

-- 
View this message in context: http://www.nabble.com/Passing-additional-arguments-through-%27...%27-tp24501159p24537455.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list