loadhistory(file = ".Rhistory")
savehistory(file = ".Rhistory")history(max.show = 25, reverse = FALSE, pattern, …)
timestamp(stamp = date(),
prefix = "##------ ", suffix = " ------##",
quiet = FALSE)
Inf
will
give all of the currently available history.grep
when doing
the matching.TRUE
, suppress printing timestamp to the console.Rgui
and interactive
Rterm
but not in batch use of Rterm
nor in
embedded/DCOM versions. The history mechanism is
The functions described here work on Unix-alikes under the
readline
command-line interface but may not otherwise (for
example, in batch use or in an embedded application). Note that R
can be built without readline
. R.app
, the console on macOS, has a separate and largely
incompatible history mechanism, which by default uses a file
.Rapp.history
and saves up to 250 entries. These functions are
not currently implemented there. The readline
history mechanism
is controlled by two environment variables: R_HISTSIZE
controls
the number of lines that are saved (default 512), and R_HISTFILE
(default .Rhistory
) sets the filename used for the
loading/saving of history if requested at the beginning/end of a
session (but not the default for
loadhistory
/savehistory
). There is no limit on the
number of lines of history retained during a session, so setting
R_HISTSIZE
to a large value has no penalty unless a large file
is actually generated. These environment variables are read at the time of saving, so can be
altered within a session by the use of Sys.setenv
. Note that readline
history library saves files with permission
0600
, that is with read/write permission for the user and not
even read permission for any other account. The timestamp
function writes a timestamp (or other message)
into the history and echos it to the console. On platforms that do not
support a history mechanism only the console message is printed.