[R] How to join two matrices?

Peng Yu pengyu.ut at gmail.com
Sat Sep 5 00:26:34 CEST 2009


Hi,

Suppose I have the following two matrices.
> x=matrix(1:4,nr=2)
> y=matrix(5:8,nr=2)

I want to join the two matrices to get the following two new matrices.
I did a search but I don't find any relevant webpage. Can somebody let
me know how to do it?

     [,1] [,2]
[1,]    1    3
[2,]    2    4
[3,]    5    7
[4,]    6    8

     [,1] [,2] [,3] [,4]
[1,]    1    3    5    7
[2,]    2    4    6    8

Regards,
Peng




More information about the R-help mailing list