[R] Rscript question
jinfengl at gene.com
Fri Feb 19 20:45:41 CET 2010
OS <oozingslackitude <at> gmail.com> writes:
> I have some code I run interactively through the R interpreter and it works
> fine. I then run it as a script with Rscript and I get an error. The error
> is coming when Rscript builds a model matrix.
> Output from Rscript with the error:
> '/usr/lib/R/bin/R --slave --no-restore --file=./matchingModel --args
> Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") :
> could not find function "is"
> Calls: glm ... model.matrix -> model.matrix.default -> contrasts<-
I ran into the same problems. Apparently, Rscript somehow doesn't automatically
load the 'methods' package. The problem can be solved by adding
in your script.
More information about the R-help