rcmd_copycat: Call and R CMD command, while mimicking the current R session

View source: R/rcmd.R

rcmd_copycatR Documentation

Call and R CMD command, while mimicking the current R session


This function is similar to rcmd(), but it has slightly different defaults:

  • The repos options is unchanged.

  • No extra environment variables are defined.


  cmdargs = character(),
  libpath = .libPaths(),
  repos = getOption("repos"),
  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 FALSE, as it is set using the system or the user profile.


Environment variables to set for the child process.


Additional arguments are passed to rcmd().

Security considerations

callr makes a copy of the user's .Renviron file and potentially of the local or user .Rprofile, in the session temporary directory. Avoid storing sensitive information such as passwords, in your environment file or your profile, otherwise this information will get scattered in various files, at least temporarily, until the subprocess finishes. You can use the keyring package to avoid passwords in plain files.

See Also

Other R CMD commands: rcmd_bg(), rcmd()

callr documentation built on Nov. 2, 2022, 5:09 p.m.