[R] Arguments for Rcmd BATCH

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Jan 10 19:18:16 CET 2009


Your R is far too old, and in particular too old for the example you 
are trying.

Please do you as asked in the posting guide to do before posting, and 
upgrade.  Then you will have Rscript, as described in the current 'An 
Introduction to R' manual for this purpose (with examples).

On Sat, 10 Jan 2009, Andrew Hicks wrote:

> 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
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list