[R] R in BATCH mode

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue May 20 17:20:43 CEST 2003

On Tue, 20 May 2003, vito muggeo wrote:

> In R<=1.6.2 I usually used the following code (in DOS prompt) to run R in
> batch mode
> C:\documents> Rcmd BATCH myfile.R
> and I could see the results (including warning messages) in the file
> myfile.Rout
> In R.1.7.0 I'm experiencing the followings:
> (1) even if I type "Rcmd BATCH myfile.R myfile.Rout",
> no file myfile.Rout is created, but just a "&1" file
> (2)After typing  "Rcmd BATCH myfile.R" the following message appears
> immediately in DOS prompt
> ARGUMENT '2' __ignored__
> (3) results are printed in file "&1", but the process is rather slow.
> Am I missing anything?
> I'm running R-1.7.0 on WinME,

Ah, so you really are at a DOS prompt.  R is designed to be run in
Windows, and this works in all versions of Windows available to me (XP and
2000, and WinME is obselete).  The problem is your so-called `shell',

Solution 1 is to get a real shell (even a real OS).

Solution 2 is to edit the rw1070/bin/BATCH file and replace

system("Rterm.exe $R_opts < $infile > $outfile 2>&1");


system("Rterm.exe $R_opts < $infile > $outfile");

and realize that probably the warning and error messages will not get 
diverted to the file.

If anyone knows definitively how to do this in command.com, please let 
R-Windows at r-project.org now.

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