setClass not found when running R script from command line setClass not found when running R script from command line r r

setClass not found when running R script from command line


Rscript, in all its wisdom, does not load the standard methods package. So precede your script with

library(methods)

and all should be good.

If you're on Linux, you could use our littler package. It loads methods for you too, and starts a little faster than Rscript too.

Edit It is now some five years later and this has been added to Rscript in R release 3.5.0 or later.