Rscript: There is no package called …?

In short, the value returned by calling Sys.getenv(‘R_LIBS_USER’) in R.exe needs to be the same as the value returned by calling this at the command line: Rscript.exe -e “Sys.getenv(‘R_LIBS_USER’)” and the above value needs to be included in this command line call: Rscript.exe -e “.libPaths()” Note that the values of R_LIBS_USER may be differ between … Read more

Passing command line arguments to R CMD BATCH

My impression is that R CMD BATCH is a bit of a relict. In any case, the more recent Rscript executable (available on all platforms), together with commandArgs() makes processing command line arguments pretty easy. As an example, here is a little script — call it “myScript.R”: ## myScript.R args <- commandArgs(trailingOnly = TRUE) rnorm(n=as.numeric(args[1]), … Read more