Reputation: 121
I'm new to R. I want to use the "pls" package to do Partial Least Square Analysis on my data.
The data information is design elements, whether exist or not, in 0 and 1 and the last column contains the emotion score. I want to find the design elements that contribute to the emotion.
From example that I found on the internet, I need to call
> plsr(density ~ NIR, 6, data=yarn, validation="CV")
When I try this:
plsr(density ~ NIR, 6, data=mydata, validation="CV")
I get this error:
Error: object 'NIR' not found
How do I call the function correctly using my data?
Thank you in advance
Upvotes: 0
Views: 1648
Reputation: 226871
This works for me (I downloaded your pastebin and saved it as a file called "junk.dat")
dat <- read.csv("junk.dat")
library("pls")
summary(plsr(Adorable~.,data=dat))
The formula Adorable~.
says that Adorable
(your last column name) is the response variable and that all of the remaining columns in the data frame should be used as predictors.
Upvotes: 2