[R] data structure for plsr

Bricklemyer, Ross S rsb at wsu.edu
Tue Oct 16 20:23:21 CEST 2007


Jim,

I tried str(yarn).  I received the following output:

'data.frame':   28 obs. of  3 variables:
 $ NIR    : num [1:28, 1:268] 3.07 3.07 3.08 3.08 3.10 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : NULL
  .. ..$ : NULL
 $ density: num  100.0  80.2  79.5  60.8  60.0 ...
 $ train  : logi  TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
TRUE ...

I think the important structure for my application is in the NIR line.
Now that I "know" what the structure is, what does it mean, and how do I
get my data into the same structure?  

Ross

*******************************************************************
Ross Bricklemyer
Dept. of Crop and Soil Sciences
Washington State University
291D Johnson Hall
PO Box 646420
Pullman, WA 99164-6420
Work: 509.335.3661
Cell/Home: 406.570.8576
Fax: 509.335.8674
Email: rsb at wsu.edu





-----Original Message-----
From: jim holtman [mailto:jholtman at gmail.com] 
Sent: Tuesday, October 16, 2007 11:13 AM
To: Bricklemyer, Ross S
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] data structure for plsr

try:

str(yarn)

to see what the structure is.

On 10/16/07, Bricklemyer, Ross S <rsb at wsu.edu> wrote:
> All,
>
> I am working with NIR spectral data and it was great to find that the
example in ?plsr also used spectral data.  Unfortunately, I am having
difficulty figuring out how the "yarn" dataset is structured to allow
for the plsr model to read:
>
> library(pls)
> data(yard)
> yarn.oscorespls <- mvr(density ~ NIR, 6, data = yarn, validation =
"CV", method = "oscorespls")
>
> dim(yarn)
>
> yarn
>
>
> Specifically, it is VERY convenient to be able to have the ~256
variables to be used in the model defined by NIR term.  When I use
dim(yarn) it claims [1] 28  3.  When I call "yarn" there is WAY more
data than 28  3.  How does this work?  I have 186 spectral bands to run
in plsr and I would really like to be able to call them using NIR or
something simlar.  I have tried labeling my spectral data ASD.###, where
### is the wavelength, but I keep getting data.frame errors.
>
> Ross
>
>
>
> *******************************************************************
> Ross Bricklemyer
> Dept. of Crop and Soil Sciences
> Washington State University
> 291D Johnson Hall
> PO Box 646420
> Pullman, WA 99164-6420
> Work: 509.335.3661
> Cell/Home: 406.570.8576
> Fax: 509.335.8674
> Email: rsb at wsu.edu
>
>
>
> ______________________________________________
> 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.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list