R, in a table, how to move rows at the bottom? -
R, in a table, how to move rows at the bottom? -
i have table this
a:
10 11 12 13 14
20 21 22 23 24
30 31 32 33 34
40 41 42 43 44
50 51 52 53 54
and want table this:
b
30 31 32 33 34
40 41 42 43 44
50 51 52 53 54
10 11 12 13 14
20 21 22 23 24
that means need take first k rows of initial matrix , set them @ bottom of matrix. how it?
how b a?
thanks
untested reasonable chance of success:
a[c( (k+1):nrow(a), 1:k) , ]
if k represents both number of rows move , w+k want them moved and there sufficient rows allow happen, perhaps untested code succeed requested modification:
a[ c( 1:(w-1) , (w+k+1):(w+2*k+1), w:(w+k), (w+2*k+2):nrow(a) ) , ]
r table matrix
Comments
Post a Comment