Rscript does not recognize setGeneric function
- by Branko K.
I am trying to convert an R script into something that a client can run in batch mode. My code uses generic functions and one snippet which is near the beginning goes like:
setGeneric("testInput", function(inputData, params = list())
standardGeneric("testInput"))
I've been using R CMD BATCH and it works fine. However I couldn't find an easy way to make my script print the output on the console, so based on that (and suggestion that Rscript.exe is the "proper" way to run R batch files) I decided to switch to Rscript. However when running the very same .R file with Rscript I get the following:
Error: could not find function "setGeneric"
Execution halted
I know there is probably a trivial reason behind this but I just cannot figure it out. Can someone please point me to where the mistake is?
Thanks so much in advance. Cheers!