[R] Split a row vector into columns

John Kane jrkrideau at yahoo.ca
Wed Jul 6 22:32:12 CEST 2011


t(matrix(rep(1:3, 3), nrow=3))


--- On Wed, 7/6/11, Peter Maclean <pmaclean2011 at yahoo.com> wrote:

> From: Peter Maclean <pmaclean2011 at yahoo.com>
> Subject: Re: [R] Split a row vector into columns
> To: r-help at r-project.org
> Received: Wednesday, July 6, 2011, 2:06 PM
> I want to create columns from this
> row vector. From:
>     x1 x2 x3 x1 x2 x3 x1 x2 x3 
>      1  2 3  1  2  3  1   2  3
> 
> to:
> x1 x2 x3
> 1  2   3
> 1  2   3
> 1  2   3 Peter Maclean
> Department of Economics
> UDSM
> 
> ______________________________________________
> 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