[R] how to collapse a list of 1 column matrix to a matrix?
ggrothendieck at gmail.com
Mon Aug 20 03:48:32 CEST 2007
L <- list(`1` = matrix(1:4, 4), `2` = matrix(5:8, 4))
Note that the list component names are kept as column names in the result
On 8/19/07, adschai at optonline.net <adschai at optonline.net> wrote:
> I encounter a situation where I have a list whose element is a column matrix. Says,
> Is there fast way to collapse the list into a matrix like a cbind operation in this case? Meaning, the result should be a matrix that looks like:
> [,1] [,2]
> [1,] 1 4
> [2,] 2 5
> [3,] 3 6
> I can loop through all elements and do cbind manually. But I think there must be a simpler way that I don't know. Thank you.
> - adschai
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help