The following commands work fine in RStudio, but not RScript:
require(glmnet)
calibdata = read.csv(\"calibrationfile.csv\")
xs = model.matrix(as.formula(\"t
RScript has this "lovely" feature of not loading the (base package) methods for you.
So all you need here is an additional
require(methods)
or
suppressMessages(library(methods))
For what it is worth, the littler command-line and scripting front-end to R that Jeff Horner and I wrote defaults to loading methods for you...