Re: [R] Creating list from matrix

2008-10-22 Thread Dimitris Rizopoulos
try this: mat <- matrix(rnorm(12*3), 3) n <- nrow(mat) p <- ncol(mat) ind <- rep(1:4, each = n*p/4) lapply(split(mat, ind), matrix, nrow = n) I hope it helps. Best, Dimitris Ron Michael wrote: Hello everyone,  I have a matrix like :  mat <- matrix(rnorm(12*3), 3)  Now I want to brea

Re: [R] Creating list from matrix

2008-10-22 Thread Henrique Dallazuanna
Try this: lapply(split(as.data.frame(t(mat)), rep(1:(ncol(mat)/3), each = 3)), t) On Wed, Oct 22, 2008 at 8:56 AM, Ron Michael <[EMAIL PROTECTED]>wrote: > Hello everyone, >  > I have a matrix like : >  > mat <- matrix(rnorm(12*3), 3) >  > Now I want to break that matrix in 4 parts each of th

[R] Creating list from matrix

2008-10-22 Thread Ron Michael
Hello everyone,   I have a matrix like :   mat <- matrix(rnorm(12*3), 3)   Now I want to break that matrix in 4 parts each of them are matrix of (3x3) and put those 4 matrices in a "list" object of length 4   Can anyone please tell me how to do that? Get your new Email address! Grab t