[R] Converting Matrix to List

arun
Thu, 23 Jan 2014 21:33:52 -0000

Hi,
Try ?split()

set.seed(484)
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]))

A.K.

Hi.

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:

[1]

.. matrix for subject 1 ..

[2]

.. matrix for subject 2 ..

etc.

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