Re: [R] How does work??

From: Duncan Murdoch <>
Date: Fri, 25 Jan 2008 06:32:08 -0500

Sergey Goriatchev wrote:
> 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:
>, 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
> actually work?
The second argument to is "args", a list of arguments to pass to the function (cbind in your case). The function doesn't know what to do when you pass it a list, it's expecting separate vectors/matrices.

In your example,, L) is equivalent to

cbind(L[[1]], L[[2]], L[[3]])
> I've read in help file this sentence: "The behavior of some
> functions, such as "substitute", will not be the same for functions
> evaluated using as if they were evaluated from the
> interpreter. The precise semantics are currently undefined and subject
> to change. "
substitute() does strange things; cbind uses standard rules, so this isn't a problem for it.

Duncan Murdoch
> Thanks for help!
> Sergey
> mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Fri 25 Jan 2008 - 11:39:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 25 Jan 2008 - 12:30:08 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive