TRUE when R is being used interactively and
  FALSE otherwise.interactive()Rterm.exe on Windows), it
  assumes that it is interactive if stdin is connected to a
  (pseudo-)terminal and not if stdin is redirected to a file or
  pipe.  Command-line options --interactive (Unix) and
  --ess (Windows, Rterm.exe) override the default
  assumption.
  (On a Unix-alike, whether the readline command-line editor is
  used is not overridden by --interactive.) Embedded uses of R can set a session to be interactive or not. Internally, whether a session is interactive determines
  stop and options("showWarnCalls"). dev.new: see options("device") interactive(): for
  example help, debugger and
  install.packages do.source,
  .First .First <- function() if(interactive()) x11()
Run the code above in your browser using DataLab