[R] How to modify the dot-dot-dot argument using level names instead of position

Duncan Murdoch murdoch.duncan at gmail.com
Wed Aug 31 15:43:50 CEST 2011


On 31/08/2011 9:41 AM, Sébastien Bihorel wrote:
> Hi,
>
> I thought "..2<- 1" was a correct way to modify the content of the
> 2nd level of dot-dot-dot because it did not return any error message.
> However, this appears to have no effect whatsoever on the content of
> dot-dot-dot. So, I guess I should modify my question to: is it
> possible to modify the content of dot-dot-dot by any means?

Not from R code.  You can achieve the same effect by converting it to a 
list, manipulating the list, and then using do.call() to pass it on.

Duncan Murdoch

> Thank
>
> On Wed, Aug 31, 2011 at 9:25 AM, Sébastien Bihorel<pomchip at free.fr>  wrote:
> >  Dear R-users,
> >
> >  In the R internals manual, it is said that one can extract the
> >  elements of the dot-dot-dot argument using the special symbols ..1 or
> >  ..2. It seems to work just fine but I was wondering if there is a way
> >  one can extract or modify the content of the dot-dot-dot argument
> >  using a level name instead of its position?
> >
> >  For instance, assuming that list(...) returns:
> >  $a
> >    [1] 1 2 3 4 5 6 7 8 9 10
> >
> >  $b
> >  [1] "a" "b" "c" "d" "e" "f" "g" "h"
> >
> >  is there a way to modify level b without knowing that it is the second level?
> >
> >  Thank you
> >
> >  Sebastien
> >
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list