R: Start a New R Session

RR Documentation

Start a New R Session

Description

Start a new R session with the specified options.

Usage

R(options = NULL, file = NULL, exprs = NULL, args = NULL,
    chdir = FALSE, ..., name = windows.type, dir, evaluated,
    simplify.brace = TRUE)

Rcmd(options = NULL, command = "", args = NULL, ..., name = windows.type,
    dir)

Rscript(options = NULL, file = NULL, exprs = NULL, args = NULL,
    chdir = FALSE, ..., name = windows.type, dir, evaluated,
    simplify.brace = TRUE)

Rterm(options = NULL, file = NULL, exprs = NULL, args = NULL,
    chdir = FALSE, ..., name = windows.type, dir, evaluated,
    simplify.brace = TRUE)

Arguments

options

character vector. The options to be provided for the new R session. For Rcmd on Windows, options will not do anything.

file

character string. The filename of the R script to run in the new R session, provided to option --file=.

exprs

character vector. The expressions to be run in the new R session, provided to option -e.

args

any R object. The command-line arguments to be provided after --args, or for Rcmd, arguments provided after command. Converted to character in a similar manner to withArgs.

chdir

logical; if TRUE and file is a pathname, the R working directory is temporarily changed to the directory containing file for evaluating.

...

further arguments passed to system().

name

the name or path of the R executable to use. By default, they will use the R executable found on Path. Specifying name can allow you to select a different version of R to run, or select a version of R tied to another application.

dir

character string; directory in which the R executables are located.

evaluated, simplify.brace

Should exprs be evaluated or substituted? Should exprs then be simplified if it is wrapped with braces?

command

character string. Naming one of the commands to execute from R CMD usage message.

Details

‘Rterm’ is an executable only available on Windows, but it is preferable because it has more intuitive quoting rules than ‘R’ (see commandQuote). If Rterm is called on a Unix-alike OS, R is called instead.

Value

The value of system(). If intern = FALSE, it is returned invisibly.

Examples

# if you're on Windows, you should notice that the quoting rules for 'Rterm' are
# far more intuituve than for 'R'
#
# if you're under a Unix-alike, you should notice that 'Rterm' and 'R' do the
# same thing


essentials::R      (exprs = r"{cat(commandArgs(), sep = "\n")}")
essentials::Rterm  (exprs = r"{cat(commandArgs(), sep = "\n")}")
essentials::Rscript(exprs = r"{cat(commandArgs(), sep = "\n")}")
essentials::Rscript(exprs = r"{cat(commandArgs(), sep = "\n")}", quiet = TRUE)


essentials::Rcmd(command = "INSTALL", args = "--help")

ArcadeAntics/essentials documentation built on Nov. 7, 2024, 4:33 p.m.