[R] How to split a matrix into a few matrices?
ayu2008
ayuazwal at yahoo.com
Wed Jan 27 12:50:46 CET 2010
Hi dear users,
I try to split a matrix into a few matrices, for example, suppose that I
have 1000X4 matrix from mvrnorm(1000,m,c) with
m<-matrix(c(0,0,0,2),4,1) and
c<-matrix(c(1.0,0.2,-0.5,0.3,0.2,1,0.2,-0.5,-0.5,0.2,1,0.2,0.3,-0.5,0.2,1),4,4,byrow=T)
How to split the matrix into
a. 2 matrices which the first one consists of the first 500 rows, and the
second one consist of the last 500 rows
b. split the matrix equally and sequentially (according to the order of the
rows) into say 10 matrices with 100 x 4 dimension
c. how to do (b) randomly, not following the order of the rows, but without
any overlapping. So all the 10 matrices will consists of different values
from the original matrix.
Your help is very much appreciated....thank you
ayu
--
View this message in context: http://n4.nabble.com/How-to-split-a-matrix-into-a-few-matrices-tp1311535p1311535.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list