[R] Convert a data frame to a 2D array?
Joris Meys
jorismeys at gmail.com
Tue Jun 8 18:21:45 CEST 2010
test <- data.frame(x=1:10,y=1:10)
as.array(as.matrix(test))
does the job too
Cheers
On Tue, Jun 8, 2010 at 6:07 PM, A Huang <mytechforum at yahoo.com> wrote:
> Hi there,
>
> I've read a file into a data frame. The data is n rows by m columns, all values are numbers.
> Is there a way to convert the data frame to a 2D array? I tried as.array(), but got some
> error messages.
>
> Thanks
>
> A. Huang
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
--
Joris Meys
Statistical consultant
Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control
tel : +32 9 264 59 87
Joris.Meys at Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
More information about the R-help
mailing list