run_r_process | R Documentation |
Start a background R process and evaluate a function call in it. It uses callr::r_process internally.
run_r_process(
func,
args = list(),
libpath = .libPaths(),
repos = c(getOption("repos"), c(CRAN = "https://cloud.r-project.org")),
cmdargs = c("--no-site-file", "--slave", "--no-save", "--no-restore"),
system_profile = FALSE,
user_profile = FALSE,
env = callr::rcmd_safe_env()
)
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. |
## Not run:
afun <- function() {
run_r_process(function() Sys.getpid())
}
synchronise(afun())
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.