Hi R-users

 

I have a series of matrices and I would like to bind them together by
column using a loop (i.e. not writing cbind(matrix1,
matrix2,matrix3....)). The reason is because in my real data set I have
a very large number of matrices.

 

Example:

 

matrix1 <- matrix (1:12,4,3)

matrix2 <- matrix (13:24,4,3)

matrix3 <- matrix (25:36,4,3)

matrix4 <- matrix (37:48,4,3)

matrix5 <- matrix (49:60,4,3)

 

for (i in 1:5)

{

  allmatrix <- cbind(matrix1, get(paste('matrix', i, sep="")))

}

 

However my command recycled the result and binds only the first and last
matrices. 

 

Thanks always for your help

 

Lorenzo


        [[alternative HTML version deleted]]

______________________________________________
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