Run an R process that mimics the current R process
Differences to r()
:
No extra repositories are set up.
The --no-save
, --no-restore
command line arguments are not used. (But --slave
still is.)
The system profile and the user profile are loaded.
No extra environment variables are set up.
r_copycat( func, args = list(), libpath = .libPaths(), repos = getOption("repos"), cmdargs = "--slave", system_profile = TRUE, user_profile = TRUE, env = character(), ... )
func |
Function object to call in the new R process.
The function should be self-contained and only refer to
other functions and use variables explicitly from other packages
using the r(.libPaths) does not work, because r(function() .libPaths()) works just fine. |
args |
Arguments to pass to the function. Must be a list. |
libpath |
The library path. |
repos |
The |
cmdargs |
Command line arguments to pass to the R process.
Note that |
system_profile |
Whether to use the system profile file. |
user_profile |
Whether to use the user's profile file.
If this is |
env |
Environment variables to set for the child process. |
... |
Additional arguments are passed to |
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.
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.