exec_r | R Documentation |
Convenience wrappers for exec_wait and exec_internal that shell out to
R itself: R.home("bin/R")
.
r_wait(
args = "--vanilla",
std_out = stdout(),
std_err = stderr(),
std_in = NULL
)
r_internal(args = "--vanilla", std_in = NULL, error = TRUE)
r_background(args = "--vanilla", std_out = TRUE, std_err = TRUE, std_in = NULL)
args |
command line arguments for R |
std_out |
if and where to direct child process |
std_err |
if and where to direct child process |
std_in |
a file to send to stdin, usually an R script (see examples). |
error |
automatically raise an error if the exit status is non-zero. |
This is a simple but robust way to invoke R commands in a separate process. Use the callr package if you need more sophisticated control over (multiple) R process jobs.
Other sys:
exec
# Hello world
r_wait("--version")
# Run some code
r_wait(c('--vanilla', '-q', '-e', 'sessionInfo()'))
# Run a script via stdin
tmp <- tempfile()
writeLines(c("x <- rnorm(100)", "mean(x)"), con = tmp)
r_wait(std_in = tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.