# test.R # Parse and use command line arguments # Invoke % R --slave --args 100 < test.R Args <- commandArgs(); # retrieve args x <- c(1:as.real(Args[4])); # get the 4th argument y <- c(x^2); # work out square png(filename="image.png"); # create image file plot(x,y); # plot image #### [1] "/usr/lib/R/bin/exec/R" [2] "--slave" [3] "--args" [4] "100"