I’ve had a hacky, but workable, setup using a mixture of
R CMD BATCH to run jobs on our local grid varying the parameters each time. Today I switched to
Rscript, and it’s been a breeze.
At the top of my .R file I put
#!/usr/bin/Rscript args <- getArgs()
and I put the
getArgs() function below in my
Then I can run the script using
./myfile.R --args myarg=something
and in the
.R file refer to
–args is used to separate arguments you want to pass to
R from those you want to be available in your script.