Rscript does not recognize setGeneric function

Posted by Branko K. on Stack Overflow See other posts from Stack Overflow or by Branko K.
Published on 2013-07-02T11:02:32Z Indexed on 2013/07/02 11:05 UTC
Read the original article Hit count: 176

Filed under:
|
|

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!

© Stack Overflow or respective owner

Related posts about r

    Related posts about batch-file