quit or its alias
q terminate the current
a character string indicating whether the environment
(workspace) should be saved, one of
the (numerical) error status to be returned to the
operating system, where relevant. Conventionally
save must be one of
"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 but may be overridden by command-line
arguments (which must be supplied in non-interactive use).
Immediately before normal termination,
executed if the function
.Last exists and
true. If in interactive use there are errors in the
function, control will be returned to the command prompt, so do test
the function thoroughly. There is a system analogue,
.Last.sys(), which is run after
runLast is true.
Exactly what happens at termination of an R session depends on the
platform and GUI interface in use. A typical sequence is to run
false), to save the workspace if requested (and in most cases also
to save the session history: see
run any finalizers (see
reg.finalizer) that have been
set to be run on exit, close all open graphics devices, remove the
session temporary directory and print any remaining warnings
.Last() and device closure).
Some error status values are used by R itself. The default error
handler for non-interactive use effectively calls
FALSE) and returns error status 1. Error status 2 is used for R
‘suicide’, that is a catastrophic failure, and other small
numbers are used by specific ports for initialization failures. It
is recommended that users choose statuses of 10 or more.
Valid values of
status are system-dependent, but
are normally valid. (Many OSes will report the last byte of the
value, that is report the value modulo 256. But not all.)
The value of
.Last is for the end user to control: as
it can be replaced later in the session, it cannot safely be used
programmatically, e.g. by a package. The other way to set code to be run
at the end of the session is to use a finalizer: see
R.app GUI on macOS has its own version of these functions
with slightly different behaviour for the
save argument (the
GUI's ‘Startup’ preferences for this action are taken into account).
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
.First for setting things on startup.
1 2 3 4 5 6 7 8 9
We want your feedback!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.