Goodnight,
I'm starting my studies with R and I'm studying the pls library, through the Introduction to the pls Package file.
I'm running the example:
`library(pls)
data(gasoline)
gasTrain <- gasoline[1:50,]
gasTest <- gasoline[51:60,]
gas1 <- plsr(octane ~ NIR, ncomp = 10, data = gasTrain, validation = "LOO")
summary(gas1)
plot(RMSEP(gas1), legendpos = "topright")
plot(gas1, ncomp = 2, asp = 1, line = TRUE)
plot(gas1, plottype = "scores", comps = 1:3)
explvar(gas1)
plot(gas1, "loadings", comps = 1:2, legendpos = "topleft",
+ labels = "numbers", xlab = "nm")
abline(h = 0)`
when I try to run the line
plot(gas1, "loadings", comps = 1:2, legendpos = "topleft", + labels = "numbers", xlab = "nm")
the message appears:
Error: unexpected '=' in: "plot(gas1, "loadings", comps = 1:2, legendpos = "topleft", + labels ="
I can't see where the error is.
I used FormatR (ctrl + shift + A) on the line.
`
plot(
gas1,
"loadings",
comps = 1:2,
legendpos = "topleft",
labels = "numbers",
xlab = "nm"
)
and remove the + sign. Now the line rotates however I get a graph like this. enter image description here.
But in the reference file it is: enter image description here
How to fix this error? thank you for the help.