EVOLUTION-MANAGER
Edit File: interactive.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: Is R Running Interactively?</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 interactive {base}"><tr><td>interactive {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Is R Running Interactively?</h2> <h3>Description</h3> <p>Return <code>TRUE</code> when <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> is being used interactively and <code>FALSE</code> otherwise. </p> <h3>Usage</h3> <pre> interactive() </pre> <h3>Details</h3> <p>An interactive <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> session is one in which it is assumed that there is a human operator to interact with, so for example <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> can prompt for corrections to incorrect input or ask what to do next or if it is OK to move to the next plot. </p> <p>GUI consoles will arrange to start <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> in an interactive session. When <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> is run in a terminal (via <code>Rterm.exe</code> on Windows), it assumes that it is interactive if ‘<span class="file">stdin</span>’ is connected to a (pseudo-)terminal and not if ‘<span class="file">stdin</span>’ is redirected to a file or pipe. Command-line options <span class="option">--interactive</span> (Unix) and <span class="option">--ess</span> (Windows, <code>Rterm.exe</code>) override the default assumption. (On a Unix-alike, whether the <code>readline</code> command-line editor is used is <strong>not</strong> overridden by <span class="option">--interactive</span>.) </p> <p>Embedded uses of <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> can set a session to be interactive or not. </p> <p>Internally, whether a session is interactive determines </p> <ul> <li><p> how some errors are handled and reported, e.g. see <code><a href="stop.html">stop</a></code> and <code><a href="options.html">options</a>("showWarnCalls")</code>. </p> </li> <li><p> whether one of <span class="option">--save</span>, <span class="option">--no-save</span> or <span class="option">--vanilla</span> is required, and if <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> ever asks whether to save the workspace. </p> </li> <li><p> the choice of default graphics device launched when needed and by <code><a href="../../grDevices/html/dev.html">dev.new</a></code>: see <code><a href="options.html">options</a>("device")</code> </p> </li> <li><p> whether graphics devices ever ask for confirmation of a new page. </p> </li></ul> <p>In addition, <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span>'s own <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> code makes use of <code>interactive()</code>: for example <code><a href="../../utils/html/help.html">help</a></code>, <code><a href="../../utils/html/debugger.html">debugger</a></code> and <code><a href="../../utils/html/install.packages.html">install.packages</a></code> do. </p> <h3>Note</h3> <p>This is a <a href="Primitive.html">primitive</a> function. </p> <h3>See Also</h3> <p><code><a href="source.html">source</a></code>, <code><a href="Startup.html">.First</a></code> </p> <h3>Examples</h3> <pre> .First <- function() if(interactive()) x11() </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>