Found the solution - already posted here http://n4.nabble.com/Rscript-question-td1067729.html#a1067729
Basically Rscript does not automatically load library(methods) like Rgui does... -- View this message in context: http://n4.nabble.com/Problem-with-factors-in-lm-when-using-Rscript-but-not-GUI-tp1678504p1678575.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.