Re: [R] Help in using PCR

From: Bjørn-Helge Mevik <b.h.mevik_at_usit.uio.no>
Date: Wed, 02 Jul 2008 13:39:30 +0200

Gavin Simpson <gavin.simpson_at_ucl.ac.uk> writes:

>> df <- data.frame(resp = dat[,1], VARS = I(as.matrix(dat[, 2:101])))
>> class(df$VARS)
> [1] "AsIs"
>
> The class is AsIs for $VARS. But if I look at your yarn data set for
> example, the NIR component is of class "matrix":
>
>> class(yarn$NIR)
> [1] "matrix"
>
> How did you achieve this?

I don't remember exactly what I did, but this will work, at least:

yarn <- data.frame(density = ..., train = ...) yarn$NIR <- as.matrix(...)

For practical purposes, I haven't found any difference between having the matrices with class "AsIs" and "matrix".

-- 
Bjørn-Helge Mevik

______________________________________________
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.
Received on Wed 02 Jul 2008 - 11:42:49 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 Jul 2008 - 12:31:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive