Thank you Barry and Laurent,

So two things for me to make sure I remember...

r.DataName (whatever DataName might be) not as I had it r.data

and Barry pre-empting my next error message with

rpy.set_default_mode(rpy.NO_CONVERSION)

Shouls rpy.set_default_mode(rpy.NO_CONVERSION) be set as standard in Rpy
scripts?

Thanks again

A grateful Scotsman.


> [EMAIL PROTECTED] wrote:
>> Thanks for that Barry thats much clearer now, I had done print yarn, and
>> didn't understand why it had returned the string "yarn". Its all clear
>> now
>> though.
>>
>> Making the change you suggest though moves me forward but then throws
>> the
>> following error
>> "Traceback (most recent call last):
>>   File "pls.py", line 8, in <module>
>>     mod = r.pcr(formula, 9, yarn, validation = 'CV')
>> rpy.RPy_RException: Error in as.data.frame.default(data, optional =
>> TRUE) :
>>   cannot coerce class "function" into a data.frame
>> "
>>
>> I'm guessing that by passing as yarn i'm mucking it up. But can't see
>> how.
>> r.data instead of yarn does the same thing
>
>   I'm not sure exactly what you've done here since there's no transcript
> and it's soooo easy to type one thing wrong accidentally (as I've
> proved!), so here's a script that does it all:
>
> import rpy
> from rpy import r
>
> r.library('pls')
> r.data('yarn')
> yarn = r.yarn
>
> # need to change the conversion mode here so mod keeps it's R-nature:
> rpy.set_default_mode(rpy.NO_CONVERSION)
> mod=r.pcr(r("density~NIR"),ncomp=9,data=yarn,validation="CV")
> rpy.set_default_mode(rpy.BASIC_CONVERSION)
>
> r.plot(mod,ncomp=9)
>
>   - if you don't change the conversion, then mod will be a python dict
> and so when it goes back into R for the r.plot(mod) call then R will
> just see an R list and not an object of class mvr.
>
>   One other thing to make sure of is that if you are using Windows to be
> certain that R's bin folder is in your PATH, otherwise you'll probably
> get an error about lapack missing when you run r.pcr.
>
> Barry
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list
>



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to