history
Print History of Evaluated Expressions

Description

Prints previously-evaluated expressions, optionally restricting the search to those expressions matching a specified pattern.

Usage

history(max.show = 25, reverse = FALSE, pattern, ...)
timestamp(stamp = date(), prefix = "##------ ", suffix = " ------##", 
    quiet = FALSE) 
loadhistory(file = ".Rhistory")
savehistory(file = ".Rhistory") 

Arguments

max.show the maximum number of expressions to print from those that match pattern. NA and NaN are not accepted. Inf is accepted and all matched expressions are printed.
reverse a logical flag. If TRUE, the expressions are printed with the most recent ones listed first. If reverse=FALSE (the default), the expressions are printed in chronological order.
pattern the pattern to use in selecting expressions.
stamp any object. Added to history.
prefix a character string. The prefix for timestamp.
suffix a character string. The suffix for timestamp.
quiet a logical value. If TRUE, stamp is invisible. If FALSE (the default), displays stamp with a prefix and a suffix.
file a character string. Indicates the path and name of the history file.
... additional arguments that could be passed to grep. Could be one or more of ignore.case, perl, fixed, useBytes and invert.

Details

The history function prints the text for top-level expressions previously-evaluated by the engine.
If the pattern argument for history is specified, previously-evaluated expressions are selected if they match this pattern. The pattern is interpreted as a regular expression, similar to regexpr. If the pattern argument is not specified, all expressions are selected.
When you add a stamp to the history using the function timestamp, you must account for differences for the character modes "RGui", "RTerm" and "LinkDLL".
The functions loadhistory and savehistory can be used only in the character modes "Rgui" and "Rterm".
Value
historyreturns invisible NULL.
loadhistoryreturns invisible NULL.
savehistoryreturns invisible NULL.
timestampreturns invisible NULL; however, if quiet = FALSE, timestamp returns stamp with a prefix and a suffix.
Warning
The pattern argument is treated as a regexpr regular expression. This is important to know if your pattern includes parentheses, brackets, dollar signs, asterisks, and so on, all of which have special meaning. In general, you are safe if you use alphabetic and numeric characters, with a period (.) in place of any other single character.
See Also
regexpr, grep.
Examples
# print the last 25 expressions
history()

# print the last 5 expressions history(max.show=5) # print all matched expressions history(Inf)

# print the last 25 expressions, in reverse chronological order history(reverse=TRUE)

# print the most recent expressions containing string "history" history(pattern="history")

# use "..." argument history(pattern = "HIST") history(pattern = "HIST", ignore.case = TRUE)

timestamp() timestamp(quiet = TRUE) timestamp(Sys.Date()) timestamp(stamp = 123, prefix = ">>>---", suffix = "---<<<") ## Not run: savehistory(".history") loadhistory(".history") ## End(Not run)

Package utils version 6.1.1-7
Package Index