[R] not understanding a do.call

Brahm, David David.Brahm at geodecapital.com
Wed Oct 18 20:12:40 CEST 2006


Mark Leeds <Mark.Leeds at morganstanley.com> wrote:
> could someone explain the difference between
> do.call("cbind",list(a,b,c,d)) and cbind(a,b,c,d).

do.call("cbind", list(a=a, b=b, c=c, d=d)) is indeed the same as
cbind(a, b, c, d).  But suppose you wanted a function to cbind any
number of vectors in reverse order:

myfun <- function(...) do.call("cbind", rev(list(...)))

-- David Brahm (brahm at alum.mit.edu)



More information about the R-help mailing list