[R] Problems using plsr() in the pls package

Rolf Turner r.turner at auckland.ac.nz
Sun Nov 20 21:40:12 CET 2016


On 21/11/16 09:03, Rui Barradas wrote:
> Hello,
>
> I know nothing about the plsr package but in the data.frame 'gasoline'
> the column NIR is numeric and in 'lid_allt2' the column lid_nose is
> character. Maybe you need
>
> lid_allt2$lid_nose <- as.numeric(lid_allt2$lid_nose)
>
> but I really don't know if this is the problem.


I have no idea either, but surely your suggestion should be:

lid_allt2$lid_nose <- as.numeric(as.character(lid_allt2$lid_nose))

or (better):

lid_allt2$lid_nose <-
     with(lid_allt2,as.numeric(levels(lid_nose))[lid.nose])


cheers,

Rolf

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276



More information about the R-help mailing list