Terminate an R Session

Usage

quit(save="default")
   q(save="default")
.Last <- function(x) { ...... }

Arguments

save a character string indicating whether the environment (workspace) should be saved.

Description

The function quit or its alias q terminate the current R session. save must be one of "no", "yes", "ask" or "default". In the first case the workspace is not saved, in the second it is saved and in the third the user is prompted and can also decide not to quit. The default is to ask in interactive use and not to save in non-interactive use, but may be overridden by command-line arguments.

Immediately before terminating, the function .Last() is executed if it exists. If in interactive use there are errors in the .Last function, control will be returned to the command prompt, so do test the function thoroughly.

See Also

.First for setting things on startup.

Examples

## Unix-flavour example
.Last <- function() {
  cat("Now sending PostScript graphics to the printer:\n")
  system("lpr Rplots.ps")
  cat("bye bye...\n")
}
quit("yes")


[Package Contents]