[R] do.call("+", ...)

Peter Dalgaard p.dalgaard at biostat.ku.dk
Fri Nov 17 15:59:24 CET 2006


Robin Hankin <r.hankin at noc.soton.ac.uk> writes:

> On 17 Nov 2006, at 14:14, Peter Dalgaard wrote:
> 
> [snip]
> 
> >
> > so a+b+c is really (a+b)+c and I was calculating a+(b+c). That's
> > actually a little bit harder because you don't get help from argument
> > matching:
> >
> > "++" <- function(...) if ((n <- nargs()) == 1) ..1 else {
> >     l <- list(...)
> >     do.call("++",l[-n]) + l[[n]]
> > }
> >
> 
> 
> Aha, the dreaded "..1" argument.   Where do I look for documentation
> on this?
> 
> [It is mentioned twice in The R Language Definition, but I'm no wiser]

It's just the first of the ... arguments, essentially list(...)[[1]],
except for lazy evaluation details. The second one is ..2, and
so forth. 

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list