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

Rui Barradas ruipbarradas at sapo.pt
Sun Nov 20 22:39:32 CET 2016


Hello,

Inline.

Em 20-11-2016 20:40, Rolf Turner escreveu:
> 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))

Actually no, I also thought of that but str(lid_allt2) doesn't say that 
lid_nose is a factor, it says "chr".

Rui Barradas

>
> or (better):
>
> lid_allt2$lid_nose <-
>      with(lid_allt2,as.numeric(levels(lid_nose))[lid.nose])
>
>
> cheers,
>
> Rolf
>



More information about the R-help mailing list