Batch Processing

You can run R non-interactively with input from infile and send output (stdout/stderr) to another file. Here are examples.

# on linux
R CMD BATCH [options] my_script.R [outfile]

# on ms windows (adjust the path to R.exe as needed)
"C:\Program Files\R\R-2.5.0\bin\R.exe" CMD BATCH
   --vanilla --slave "c:\my projects\my_script.R"

Be sure to look at the section on I/O for help writing R scripts.

See an Introduction to R (Appendix B) for information on the command line options.