[R] Matrix to list object

2009-12-28 Thread Ron_M
let consider following matrix : mat - matrix(rnorm(45), 15) Now I want to convert it to a list object mat_list, which will have 15 elements and each element will again be a matrix with 3 rows and 3 columns. How can I do that? Thanks, -- View this message in context:

Re: [R] Matrix to list object

2009-12-28 Thread Henrique Dallazuanna
Try this: mat_list - lapply(split(mat, seq(nrow(mat))), matrix, ncol = 3) On Mon, Dec 28, 2009 at 9:20 AM, Ron_M ron_michae...@yahoo.com wrote: let consider following matrix : mat - matrix(rnorm(45), 15) Now I want  to convert it to a list object mat_list, which will have 15 elements and