| 63556 |
ripley |
1 |
% File src/library/utils/man/BATCH.Rd
|
| 68948 |
ripley |
2 |
% Part of the R package, https://www.R-project.org
|
| 63556 |
ripley |
3 |
% Copyright 1995-2013 R Core Team
|
| 42333 |
ripley |
4 |
% Distributed under GPL 2 or later
|
|
|
5 |
|
| 27445 |
ripley |
6 |
\name{BATCH}
|
| 56186 |
murdoch |
7 |
\alias{BATCH}
|
| 27445 |
ripley |
8 |
\title{Batch Execution of R}
|
|
|
9 |
\description{Run \R non-interactively with input from \code{infile} and
|
|
|
10 |
send output (stdout/stderr) to another file.}
|
|
|
11 |
\usage{
|
| 34190 |
hornik |
12 |
\special{R CMD BATCH [options] infile [outfile]}
|
| 27445 |
ripley |
13 |
}
|
|
|
14 |
\arguments{
|
|
|
15 |
\item{infile}{the name of a file with \R code to be executed.}
|
|
|
16 |
\item{options}{a list of \R command line options, e.g., for setting the
|
|
|
17 |
amount of memory available and controlling the load/save process.
|
| 49704 |
hornik |
18 |
If \code{infile} starts with a \samp{-}, use \option{--} as the final
|
|
|
19 |
option.
|
| 63556 |
ripley |
20 |
The default options are \option{--restore --save --no-readline}.
|
|
|
21 |
(Without \option{--no-readline} on Windows.)
|
|
|
22 |
}
|
| 27445 |
ripley |
23 |
\item{outfile}{the name of a file to which to write output. If not
|
|
|
24 |
given, the name used is that of \code{infile}, with a possible
|
|
|
25 |
\file{.R} extension stripped, and \file{.Rout} appended.}
|
|
|
26 |
}
|
|
|
27 |
\details{
|
| 49612 |
hornik |
28 |
Use \command{R CMD BATCH --help} to be reminded of the usage.
|
| 27445 |
ripley |
29 |
|
|
|
30 |
By default, the input commands are printed along with the output. To
|
|
|
31 |
suppress this behavior, add \code{options(echo = FALSE)} at the
|
| 77228 |
maechler |
32 |
beginning of \code{infile}, or use option \option{--no-echo}.
|
| 27445 |
ripley |
33 |
|
|
|
34 |
The \code{infile} can have end of line marked by LF or CRLF (but not
|
|
|
35 |
just CR), and files with an incomplete last line (missing end of line
|
|
|
36 |
(EOL) mark) are processed correctly.
|
| 37652 |
ripley |
37 |
|
| 40416 |
ripley |
38 |
A final expression \samp{proc.time()} will be executed after the input
|
| 61162 |
ripley |
39 |
script unless the latter calls \code{\link{q}(runLast = FALSE)} or is aborted.
|
| 47821 |
ripley |
40 |
This can be suppressed by the option \option{--no-timing}.
|
| 61433 |
ripley |
41 |
|
| 37652 |
ripley |
42 |
Additional options can be set by the environment variable
|
| 63556 |
ripley |
43 |
\env{R_BATCH_OPTIONS}: these come after the default options (see the
|
|
|
44 |
description of the \code{options} argument) and before any options
|
|
|
45 |
given on the command line.
|
| 27445 |
ripley |
46 |
}
|
|
|
47 |
\note{
|
| 75093 |
maechler |
48 |
On Unix-alikes only: Unlike \command{Splus BATCH}, this does not run the \R
|
| 63556 |
ripley |
49 |
process in the background.
|
|
|
50 |
In most shells, \preformatted{R CMD BATCH [options] infile [outfile] &}
|
| 27445 |
ripley |
51 |
will do so.
|
|
|
52 |
}
|
|
|
53 |
\keyword{utilities}
|