[R] what can one do with (to) '..." ?

Duncan Murdoch murdoch.duncan at gmail.com
Tue Aug 16 12:40:05 CEST 2011


On 11-08-16 6:28 AM, Carl Witthoft wrote:
> Sorry - I wanted to dig a bit deeper than that.  I certainly appreciate
> your point, as well as the other recent responses, but what I'm trying
> to figure out is:  what does the last function called do to interpret
> the "..." ?  Suppose I have:

The best source for this (but it's not easy) is to look at the R 
sources.  "..." is called R_DotsSymbol there.  Most of the important 
handling happens in https://svn.r-project.org/R/trunk/src/main/eval.c, 
but it also shows up in a number of other places.

Duncan Murdoch

>
>
> foo<-function(x,y,...){
> z<-x+y
> plot(z,...)
> }
>
> I am fully comfortable with that sort of use.  But,  what does plot (or
> its internal calls) use for code to turn the contents of "..." into
> local named arguments?  Is it something like
>
> arg.dot<-list(...)
> if ( some_match_func("foo", names(arg.dot) ) foo<-arg.dot$foo   else
> foo<- default_value
>
> ?
> Or are there better constructs?
>
> thanks again for all info, and for your patience with me :-)
>
> Carl
>
>
> On 8/15/11 9:40 PM, Comcast wrote:
>> Inside your function that has a ... argument, you can get the optional arguments with :
>>
>> Arg.dot<- list(...)
>>
>> Section 2.1.5 of the R Language Definition which should be accessible from the help facility would appear to be sensible place to start. "Programming for Data Analysis" could also be purchased.
>



More information about the R-help mailing list