[R] Problems with data structure when using plsr() from package pls

Bjørn-Helge Mevik b.h.mevik at usit.uio.no
Fri Jan 15 13:33:10 CET 2016

CG Pettersson <cg.pettersson at lantmannen.com> writes:

>> frame1 <- data.frame(gushVM, I(n96))


>> pls1 <- plsr(gushVM ~ n96, data = frame1)
> Error in model.frame.default(formula = gushVM ~ n96, data = frame1) :
>   invalid type (list) for variable 'n96'

As far as I can remember, you get this error if the n96 object was a
data.frame instead of a matrix.  Can you check with, e.g.,

> class(n96)

If it says "data.frame", try using I(as.matrix(n96)).

Bjørn-Helge Mevik

More information about the R-help mailing list