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

Robin Hankin r.hankin at noc.soton.ac.uk
Mon Nov 20 14:43:08 CET 2006


On 17 Nov 2006, at 15:09, Peter Dalgaard wrote:

[discussion of ..1 vs list(...)[[1]] snipped]


>
> Try
>
> g <- function(...) list(...)[[1]]
> h <- function(...) ..1
>
> g((print("Hey")), (print("Joe")))
> h((print("Hey")), (print("Joe")))
>
> and you should become enlightened. Bonus points for figuring out why I
> parenthesized the arguments.
>
>


I see the difference between g() and h(), but
AFAICS the parentheses make no difference:



 > jj <- g((print("Hey")), (print("Joe"))) ; jj
[1] "Hey"
[1] "Joe"
[1] "Hey"
 >
 > jj <- g(print("Hey"), print("Joe")) ; jj
[1] "Hey"
[1] "Joe"
[1] "Hey"
 >
 >
 > jj <- h((print("Hey")), (print("Joe"))) ; jj
[1] "Hey"
[1] "Hey"
 >
 > jj <- h(print("Hey"), print("Joe")) ; jj
[1] "Hey"
[1] "Hey"
 >




--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743



More information about the R-help mailing list