[R] Converting Matrix to List

arun smartpink111 at yahoo.com
Thu Jan 23 22:33:52 CET 2014

Try ?split()

mat1 <- cbind(rep(1:8,c(2,4,3,6,8,4,3,10)),matrix(sample(200,40*10,replace=TRUE),nrow=40))
res <- split(as.data.frame(mat1[,-1]),as.matrix(mat1[,1]))



I have very large matrix of 2648 observations by 98 people in a 
study. They are covariance matrices for certain variables stacked one 
upon the other for the 98 participants, marked by a collumn indicating 
subject number. I need to convert it to a list that includes 98 sub 
covariance matrices, such that: 


.. matrix for subject 1 .. 


.. matrix for subject 2 .. 


Can anyone please help me? I've searched online and I cant figure out how to do it

More information about the R-help mailing list