[R] replicate rows

Ernest Adrogué nfdisco at gmail.com
Fri Feb 3 13:22:11 CET 2012

 3-02-2012, 11:26 (+0000); Schumacher, G. escriu:
> I have a matrix of 17 rows and 20 columns. I want to replicate this
> matrix 20 times, but I only want to replicate the rows. How do I do
> that?

If x is your matrix, this

x[rep(1:17, 20),]

will give you a matrix with 340 rows and 20 columns which I think is
what you want.


More information about the R-help mailing list