[R] one long column of data -> three small columns

Peter Alspach Peter.Alspach at plantandfood.co.nz
Tue Nov 3 20:47:28 CET 2009


Tena koe

?matrix 

The exact syntax will depend on the class of your 'column of data'.  If
it is a dataframe, for example, then try

matrix(yourData[,1], 3, 3)

HTH ...

Peter Alspach 

> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of frenchcr
> Sent: Wednesday, 4 November 2009 8:06 a.m.
> To: r-help at r-project.org
> Subject: [R] one long column of data -> three small columns
> 
> 
> say i have a column of data like this...
> 
> 2
> 3
> 4
> 2
> 1
> 6
> 6
> 4
> 7
> 
> and i want it in three columns like this
> 
> 226
> 314
> 467
> 
> ...so i can make a contour plot.
> 
> 
> How do i do this?
> --
> View this message in context: 
> http://old.nabble.com/one-long-column-of-data--%3E-three-small
> -columns-tp26163165p26163165.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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