R: Run an R CMD command

rcmd {callr} | R Documentation

## Run an R CMD command

### Description

Run an R CMD command form within R. This will usually start another R process, from a shell script.

### Usage

    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())

### Arguments

`cmd` | 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.
`cmdargs` | Command line arguments.
`libpath` | The library path.
`repos` | 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.
`stdout` | Optionally a file name to send the standard output to.
`stderr` | Optionally a file name to send the standard error to.
`show` | 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.
`callback` | 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.
`system_profile` | Whether to use the system profile file.
`user_profile` | Whether to use the user's profile file.
`env` | Environment variables to set for the child process.

### Value

A list with the standard output (`$stdout`), standard error (`stderr`) and exit status (`$status`) of the external `R CMD` command.

### See Also

Other R CMD commands: `rcmd_safe`

### Examples

    rcmd("config", "CC")

[Package callr version 1.0.0 Index]