EVOLUTION-MANAGER
Edit File: exec_r.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Execute R from R</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for exec_r {sys}"><tr><td>exec_r {sys}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Execute R from R</h2> <h3>Description</h3> <p>Convenience wrappers for <a href="exec.html">exec_wait</a> and <a href="exec.html">exec_internal</a> that shell out to R itself: <code>R.home("bin/R")</code>. </p> <h3>Usage</h3> <pre> 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) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>args</code></td> <td> <p>command line arguments for R</p> </td></tr> <tr valign="top"><td><code>std_out</code></td> <td> <p>if and where to direct child process <code>STDOUT</code>. Must be one of <code>TRUE</code>, <code>FALSE</code>, filename, connection object or callback function. See section on <em>Output Streams</em> below for details.</p> </td></tr> <tr valign="top"><td><code>std_err</code></td> <td> <p>if and where to direct child process <code>STDERR</code>. Must be one of <code>TRUE</code>, <code>FALSE</code>, filename, connection object or callback function. See section on <em>Output Streams</em> below for details.</p> </td></tr> <tr valign="top"><td><code>std_in</code></td> <td> <p>a file to send to stdin, usually an R script (see examples).</p> </td></tr> <tr valign="top"><td><code>error</code></td> <td> <p>automatically raise an error if the exit status is non-zero.</p> </td></tr> </table> <h3>Details</h3> <p>This is a simple but robust way to invoke R commands in a separate process. Use the <a href="https://cran.r-project.org/package=callr">callr</a> package if you need more sophisticated control over (multiple) R process jobs. </p> <h3>See Also</h3> <p>Other sys: <code><a href="exec.html">exec</a></code> </p> <h3>Examples</h3> <pre> # 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) </pre> <hr /><div style="text-align: center;">[Package <em>sys</em> version 3.4 <a href="00Index.html">Index</a>]</div> </body></html>