rscript
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
Determine path of the executing script
Here there is a simple solution for the problem. This command: script.dir <- dirname(sys.frame(1)$ofile) returns the path of the current script file. It works after the script was saved.