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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to