.BG
.FN history
.FN again
.TL
Display and Re-Execute S Expressions
.CS
history(pattern = ".", max = 10,
    evaluate=T, call, menu=T, graphics=T,
    where, editor)
again(pattern = ".", editor=F)
.AG pattern
pattern to select expressions.
Previously evaluated expressions will be selected from the
audit file if they match this pattern (as a regular expression in the
sense of the `awk' language).
See also argument `call'.
.AG max
maximum number of expressions to consider.
.AG evaluate
logical flag: should the selected expression be evaluated?
.AG call
if this argument is given instead of `pattern', the search is restricted
to expressions containing calls(that is, to
expressions containing this pattern followed by a left parenthesis).
(In this case remember that other arguments, like `max' need to given
in the `name=value' form, so they will not match `pattern'.)
.AG menu
if `TRUE', a menu of the selected expressions is presented, allowing
one to be selected.
If `FALSE', the entire set of selected expressions
processed.
.AG graphics
if `TRUE', graphics menus will be used, if available.  See function `menu'.
.AG where
if this argument is supplied, `history' will look for an audit file in
the specified place, rather than in the current working directory.
The `where' argument is similar to the same argument to `get'; that is,
it can be numeric to specify a position in the search list, or a character
vector of length 1 to specify an actual directory.
.AG editor
object describing how selected command should be edited.
If `editor' is a function (typically an editor function like `ed'
or `vi'), that function will be invoked on the history selection.
A character `editor' will be taken as the name of a function.
If `editor' is `TRUE', this is equivalent to `editor=options("editor")'.
.PP
The `history' function looks backwards through the audit file,
trying to find the most recent
`max' expressions that match the `pattern' or `call'
pattern.
When these are found,
if `evaluate' is `TRUE', you will be requested,
via the `menu' function, to select one of them.
If you make a selection,
the selected expression will then be evaluated by S.
.PP
The `pattern' is treated as a regular expression.
This is important to know if your pattern includes parentheses,
brackets, dollar signs, asterisks, etc.
Each of these characters has a special meaning in a regular expression.
In general, you will be safe if you use alphabetic and numeric characters,
with periods (.) in the place of any other character.  A period
matches anything.
.PP
The function `again' re-evaluates the last matching
expression.
`again()' is equivalent to `history(max=1)'.
.RT
Either the value of the selected expression, or the parsed, but
unevaluated version, if `evaluate' is `FALSE'.
.SE
The selected expression is evaluated, if `evaluate' is `TRUE'.
.EX
history()  # menu of last 10 expressions
history(max=20) # the last 20 expressions
history("plot") # recent references to plot
history(call=plot,max=1) #re-evaluate the last call to plot
again() #re-evaluate the last expression
e <- again(editor=T)
e() #edit and re-execute last expression
.KW file
.KW programming
.KW documentation
.WR
