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 Microsoft Windows (adjust the path to R.exe as needed)
"C:\Program Files\R\R-2.13.1\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.