This help topic is for R version 2.9.0. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/utils/html/BATCH.html
BATCH {utils}R Documentation

Batch Execution of R

Description

Run R non-interactively with input from infile and send output (stdout/stderr) to another file.

Usage

R CMD BATCH [options] infile [outfile]

Arguments

infile

the name of a file with R code to be executed.

options

a list of R command line options, e.g., for setting the amount of memory available and controlling the load/save process. If infile starts with a ‘⁠-⁠’, use ‘⁠--⁠’ as the final option. The default options are ‘⁠--restore --save⁠’.

outfile

the name of a file to which to write output. If not given, the name used is that of infile, with a possible ‘.R’ extension stripped, and ‘.Rout’ appended.

Details

Use R CMD BATCH --help to be reminded of the usage.

By default, the input commands are printed along with the output. To suppress this behavior, add options(echo = FALSE) at the beginning of infile, or use option ‘⁠--slave⁠’.

Files with an incomplete last line (no end of line mark) are accepted.

A final expression ‘⁠proc.time()⁠’ will be executed after the input script unless the latter calls q(runLast=FALSE) or is aborted. This can be suppressed by the option --no-timing.

Additional options can be set by the environment variable R_BATCH_OPTIONS: these come after ‘⁠--restore --save⁠’ and before any options given on the command line.


[Package utils version 2.9.0 ]