BATCH {base} | R Documentation

## Batch Execution of R

### Description

Run R non-interactively with input from a given file and place 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.
`outfile` | the name of a file to which to write output. If not given, the name used is the one of `infile`, with a possible ‘`.R`’ extension stripped, and ‘`.Rout`’ appended.

### Details

By default, the input commands are printed along with the output. To suppress this behavior, add `options(echo = FALSE)` at the beginning of `infile`.

The `infile` can have end of line marked by LF or CRLF (but not just CR), and files with a missing EOL mark are processed correctly.

Using `R CMD BATCH` sets the GUI to `"none"`, so none of `x11`, `jpeg` and `png` are available.

### Note

Unlike `Splus BATCH`, this does not run the R process in the background. In most shells, `R CMD BATCH [options] infile [outfile] &` will do so.

[Package Contents]