Scripting Front-End for R
This is an alternative front end for use in #! scripts and other scripting applications.
Rscript [options] [-e expr [-e expr2 ...] | file] [args]
- a list of options, all beginning with --. These can be any of the options of the standard R front-end, and also those described in the details.
- expr, expr2
- R expression(s), properly quoted.
- the name of a file containing R commands. -
- arguments to be passed to the script in
Rscript --help gives details of usage, and
Rscript --version gives the version of
Rscript. Other invocations invoke the R front-end with selected options. This
front-end is convenient for writing #! scripts since it is an
executable and takes
file directly as an argument. Options
--slave --no-restore are always supplied: these imply
--no-save. (The standard Windows command line has no concept
of #! scripts, but Cygwin shells do.) Either one or more -e options or
be supplied. When using -e options be aware of the quoting
rules in the shell used: see the examples. Additional options accepted (before
- gives details of what
Rscriptis doing. Also passed on to R.
listis a comma-separated list of package names or
NULL. Sets the environment variable
R_DEFAULT_PACKAGESwhich determines the packages loaded on startup. The default for
Rscriptomits methods as it takes about 60% of the startup time.
file(but will need to be protected from the shell in use, if any, for example by enclosing the argument in quotes). Normally the version of R is determined at installation, but this can be overridden by setting the environment variable
RHOME. The R files are found from the location of the
Rscript.exeexecutable. If this is copied elsewhere, the environment variable
RHOMEshould be set to the top directory of the R installation. Unlike Unix-alikes, this links directly to
R.dllrather than running a separate process.
stdin()refers to the input file, and
stdinfile stream of the process.
Rscript is only supported on systems with the