[R] Dataframes in PLS package
R. Michael Weylandt
michael.weylandt at gmail.com
Sun Mar 4 03:17:58 CET 2012
Can you post dput(head(eqn, 30)) so we can take a look at your data?
It's something of a cryptic error and that would go a long way in
helping us help you.
Without that though, I'm not sure you need the I(as.matrix.(dep)) and
I(as.matrix(ind)), I would imagine (untested) that eqn <-
data.frame(depy = dep, indx = ind) would work (probably better as I()
changes things just a little).
I have a hunch that the colnames of eqn are not actually depy and indx
and that's what ultimately leads to the error. Can you look at
colnames(eqn) and use those exactly in the formula to plsr? That might
fix it.
Michael
On Sat, Mar 3, 2012 at 5:01 PM, westland <westland at uic.edu> wrote:
> I am still/again having trouble getting PLSR to recognize the input data
> frames. Here is what I have done:
>
> I read in an 10000 x 8 table of data to 'pls'
>
> assign the first four columns to matrix 'dep' and the second four to matrix
> 'ind' with the following commands:
>
> dep <- pls[,1:4]
> ind <- pls[,5:8]
>
> I create the data.frame 'eqn' :
>
> eqn <- data.frame(depy = I(as.matrix(dep)), indx = I(as.matrix(ind)))
>
> And run the PLSR package
>
> apls <- plsr(depy ~ indx, data=eqn)
>
> I seem to be getting either one of two error messages:
>
> [12] ERROR:
> invalid type (list) for variable 'dep'
> [13] ERROR:
> object of type 'closure' is not subsettable
>
> I'm sure now that this is a problem in my creation of data.frames, but can't
> seem to find anything that describes the problem
>
>
> -----
> J. Christopher Westland
> Professor, Information & Decision Sciences, University of Illinois - Chicago
> 601 S. Morgan Street (UH2400) Chicago, IL 60607-7124
> Telephone +1.312.860.0587
> Google Voice +1.209.757.8849
> westland at uic.edu
> http://uic.edu/~westland
> --
> View this message in context: http://r.789695.n4.nabble.com/Dataframes-in-PLS-package-tp4405798p4442436.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