[R] Arguments for Rcmd BATCH

Andrew Hicks andrew at quanttoolbox.com
Sat Jan 10 14:12:11 CET 2009


Sorry to bother you and I hope this will be easy to solve.

 

I am trying to run R scripts in batch, called from another programme, under
Windows XP. I have R 2.4.1

 

I need to be able to pass a list of numeric arguments to the script as well.

 

The Rscript and its input data file are attached.

 

I have been trying the syntax below but it doesn't work:

 

Rcmd BATCH -no-save -no-restore -args parms=c(1,2,3) test01b.R

 

(each of these BATCH options is preceded by 2 - characters, but my Outlook
is munging them together here)

 

The script then accesses (or tries to) the variables as parms[1], parms[2],
etc.

 

I get the respose "unable to open input file" at the command line and no
other diagnostic output.

 

I got this syntax from p85 of the R-Intro doc and from the website
http://quantitative-ecology.blogspot.com/search/label/scripts. I could not
find any other illustrations or instructions of how to use args with BATCH.

 

Without using any parameter args it otherwise runs fine.

 

Please can you advise what am I doing wrong and how should this command be
structured? Do I also need to change the way the script is accessing the
arguments?

 

Many thanks,

 

Andrew Hicks



More information about the R-help mailing list