[R] rearrange data columns

Gabor Grothendieck ggrothendieck at gmail.com
Thu Oct 11 17:19:44 CEST 2007


Try this:

   matrix(rbind(a, b), nrow(a))


On 10/11/07, Martin Ivanov <tramni at abv.bg> wrote:
> Dear R users,
>  I need to to the the following. Let a= 1 2 3
>                                         4 5 6
>  and b= -1 -2 -3  be (2x3) matrices.
>        -4 -5 -6
>  I need to combine the two matrices into a new (2x6) matrix like this:
>
>  ab = ( 1 -1 2 -2 3 -3 )
>        4 -4 5 -5 6 -6
>
>  How can this be done in R?
>
>
>
> -----------------------------------------------------------------
> Крайна цел - Да оцелееш! www.survivor.btv.bg
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


More information about the R-help mailing list