[R] How to run R in batch mode

Duncan Murdoch murdoch at stats.uwo.ca
Fri Nov 18 18:11:54 CET 2005


On 11/18/2005 11:25 AM, Beatriz wrote:
> I write
> R CMD BATCH test.R
> in my R console
> 
> I have send you an image (RunBatch.jpg) of my console and the "test.R" file

I don't think the jpg made it to R-help, but I saw it.  You tried to run 
R CMD BATCH test.R from within R.  That's meant to be a system command.

Since you're running in Windows, you should open a command shell.  One 
way to do that is to choose "Run..." from the Start Menu, and enter 
"cmd".  You'll get a black command shell window.

If your path is set properly so that you can run R from there, then
R CMD BATCH test.R should work.

There is a way to do this from within R:  run

 > system("R CMD BATCH test.R",intern=TRUE)

This still depends on your path being set correctly to find R.

Duncan Murdoch




More information about the R-help mailing list