Hi!

Is there a fast way to duplicate rows in a matrix?
I would like to do the following:

change a matrix A like:
     [,1] [,2] 
 [1,] Kevin 1
 [2,] Alf 2

into :
     [,1] [,2] 
 [1,] Kevin 1
 [2,] Kevin 1
 [3,] Alf 2
 [4,] Alf 2

i.e. double all rows. The only way I could think off
was: rbind(A[1,],A[1,],A[2,],A[2,]) - which is really
impractible, of course.

Can anyone help, please?
Thank you,
Silvia

______________________________________________
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