[R] How does do.call() work??

Sergey Goriatchev sergeyg at gmail.com
Fri Jan 25 11:27:57 CET 2008


Dear members of R forum,

Say I have a list:

L <- list(1:3, 1:3, 1:3)

that I want to turn into a matrix.

I wonder why if I do:

do.call(cbind, L)

I get the matrix I want, but if I do

cbind(L)

I get something different from what I want. Why is that? How does
do.call() actually work?

I've read in do.call() help file this sentence: "The behavior of some
functions, such as "substitute", will not be the same for functions
evaluated using do.call as if they were evaluated from the
interpreter. The precise semantics are currently undefined and subject
to change. "

Thanks for help!
Sergey

-- 
I'm not young enough to know everything. /Oscar Wilde

Experience is one thing you can't get for nothing. /Oscar Wilde

When you are finished changing, you're finished. /Benjamin Franklin



More information about the R-help mailing list