Run an R CMD command form within R. This will usually start another R process, from a shell script.
rcmd(cmd, cmdargs = character(), libpath = .libPaths(),
repos = getOption("repos"), stdout = NULL, stderr = NULL,
show = FALSE, callback = NULL, system_profile = FALSE,
user_profile = FALSE, env = character())
Command to run. See R --help
from the command
line for the various commands. In the current version of R (3.2.4)
these are: BATCH, COMPILE, SHLIB, INSTALL, REMOVE, build, check,
LINK, Rprof, Rdconv, Rd2pdf, Rd2txt, Stangle, Sweave, Rdiff, config,
javareconf, rtags.
Command line arguments.
The library path.
The ‘repos’ option. If NULL
, then no
repos
option is set. This options is only used if
user_profile
or system_profile
is set to FALSE
,
as it is set using the system or the user profile.
Optionally a file name to send the standard output to.
Optionally a file name to send the standard error to.
Logical, whether to show the standard output on the screen
while the child process is running. Note that this is independent
of the stdout
and stderr
arguments. The standard
error is not shown currently.
A function to call for each line of the standard
output from the child process. It works together with the show
option; i.e. if show = TRUE
, and a callback is provided, then
the output is shown of the screen, and the callback is also called.
Whether to use the system profile file.
Whether to use the user's profile file.
Environment variables to set for the child process.
A list with the standard output ($stdout
), standard
error (stderr
) and exit status ($status
) of the
external R CMD
command.
Other R CMD commands: rcmd_safe
# NOT RUN {
rcmd("config", "CC")
# }
Run the code above in your browser using DataCamp Workspace