The following code (taken from the pls package manual) works in R...
<code>
data(yarn)
nir.pcr <- pcr(density ~ NIR, ncomp = 9, data = yarn, validation = "CV")
plot(nir.pcr, ncomp = 5)
plot(nir.pcr, "scores")
</code>
Trying to translate this into RPy i get the following...
<code>
from rpy import *
r.library("pls")
yarn=r.data('yarn', package="pls")
formula=r('density ~ NIR')
mod = r.pcr(formula, ncomp = 9, data = yarn, validation = "CV")
r.plot(mod, ncomp = 5)
r.plot(mod, "scores")
</code>
But this gives the following error...
Traceback (most recent call last):
File "pls.py", line 7, in <module>
mod = r.pcr(formula, ncomp = 9, data = yarn, validation = "CV")
rpy.RPy_RException: Error in eval(predvars, data, env) : invalid 'envir'
argument
Its probably a newbie error but I'd really appreciate it if someone can
tell me what it is I'm doing wrong.
Thanks in advance
Chris
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/rpy-list