in reply to Re^3: Passing parameters to R script
in thread Passing parameters to R script

In Bash shell
# a=1 # b=10 # Rscript -e "args<-commandArgs(TRUE);x=args[1]:args[2];x;mean(x);sd(x +)" $a $b [1] 1 2 3 4 5 6 7 8 9 10 [1] 5.5 [1] 3.027650

So you can control variables on the command line R script and you can feed these variables into R itself using commandArgs(TRUE), and manipulate the variables as args1 and args2. So if I imagine if you are doing a system call in perl, you can also construct a similar Rscript on the command line, and get the output accordingly, which you can manipulate further within perl (or any other script).