Skip to content
Prev 170777 / 398506 Next

R scripts and parameters

On 2/17/2009 10:55 AM, mauede at alice.it wrote:
Gabor gave you a solution from within R.  If you want to run a script 
from the command line, then use commandArgs(TRUE).  For example, put 
this into the file test.R:

commandArgs(TRUE)

(The TRUE says you only want to see the trailing arguments, not 
everything else on the command line.)

Then from the command line, do

Rscript test.R A B C

and you'll see the output

[1] "A" "B" "C"

Duncan Murdoch