[R] replicate matrix

wendy wendy.qiao at utoronto.ca
Sun Feb 21 03:58:28 CET 2010


Hi all,

I have a matrix, for example
     [,1] [,2]
[1,]  1    3
[2,]  4    6

I want to replicate the matrix twice and add an extra column at the end,
which is
     [,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,]  1    3     1    3     1    3    2
[2,]  4    6     4    6     4    6    5

I found 'rep' only works for vector. Does anyone know how to replicate a
matrix, and append the matrix?

Thank you in advance,
Wendy  


-- 
View this message in context: http://n4.nabble.com/replicate-matrix-tp1563337p1563337.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list