Rev 50377 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/base/man/interactive.Rd% Part of the R package, http://www.R-project.org% Copyright 1995-2009 R Core Development Team% Distributed under GPL 2 or later\name{interactive}\alias{interactive}\title{Is R Running Interactively?}\description{Return \code{TRUE} when \R is being used interactively and\code{FALSE} otherwise.}\usage{interactive()}\details{An interactive \R session is one in which it is assumed that there isa human operator to interact with, so for example \R can prompt forcorrections to incorrect input or ask what to do next or if it is OKto move to the next plot.GUI consoles will arrange to start \R in an interactive session. When\R is run in a terminal (via \command{Rterm.exe} on Windows), itassumes that it is interactive if \file{stdin} is connected to a(pseudo-)terminal and not if \file{stdin} is redirected to a file orpipe. Command-line options \option{--interactive} (Unix) and\option{--ess} (Windows, \command{Rterm.exe}) override the defaultassumption.#ifdef unix(On a Unix-alike, whether the \code{readline} comamnd-line editor isused is \strong{not} overridden by \option{--interactive}.)#endifEmbedded uses of \R can set a session to be interactive or not.Internally, whether a session is interactive determines\itemize{\item how some errors are handled and reported, e.g. see\code{\link{stop}} and \code{\link{options}("showWarnCalls")}.\item whether one of \option{--save}, \option{--no-save} or\option{--vanilla} is required, and if \R ever asks whether to save theworkspace.\item the choice of default graphics device launched when needed andby \code{\link{dev.new}}: see \code{\link{options}("device")}\item whether graphics devices ever ask for confirmation of a newpage.}In addition, \R's own \R code makes use of \code{interactive()}: forexample \code{\link{help}}, \code{\link{debugger}} and\code{\link{install.packages}} do.}\note{This is a \link{primitive} function.}\seealso{\code{\link{source}},\code{\link{.First}}}\examples{.First <- function() if(interactive()) x11()}\keyword{environment}\keyword{programming}