Hi
r-help-bounces at r-project.org napsal dne 02.02.2009 16:52:06:
Hi,
I have a very basic question on merging two matrices by alternating the
rows. For illustration, assume two matrices -
A looks like:
10 10
10 10
B looks like:
20 20
20 20
How do I combine them such that I get alternating rows from A and B? My
final result should be C which looks like:
10 10
20 20
10 10
20 20
I would rbind both matrices and then indexed the resulting matrix.
x<-rep(10,4)
y<-rep(20,4)
dim(x)<-c(2,2)
dim(y)<-c(2,2)
z<-rbind(x,y)