From: <ch...@li...> - 2008-05-31 09:58:35
|
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 |