[R] list element to matrix

Friedrich Schuster mail at friedrich-schuster.de
Wed Sep 5 21:21:44 CEST 2007


You get the number of list elements with length(D), 
the dimensions of M1 with dim(M1)

see help with: 
?dim
?length

Hope this helps...


>I have created a list of "matrices" using sapply or lapply and wish to 
>extract each of the "matrices" as a matrix.  Some of them are 2x2, 3x3, etc.

>I can do this one at a time as:

>M1<-as.matrix(D[[1]])

>How can repeat this process for an unknown number of entries in the list?  In 
>other words, how shall I index M1?


>Diana

-- 

Friedrich Schuster
mail at friedrich-schuster.de
Tel.: +49 6221 737474
Tel.: +49 163 7374744



More information about the R-help mailing list