[R] How to join two matrices?

Peng Yu
2009-09-04T22:26:34Z

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