Usage

Arguments

an environment or a list object. Defaults to the
current evaluation environment.

Details

The typical use of substitute is to create informative labels
for data sets and plots.
The myplot example below shows a simple use of this facility.
It uses the functions deparse and substitute
to create labels for a plot which are character string versions
of the actual arguments to the function myplot.

Substitution takes place by examining each component of the parse tree
as follows: If it is not a bound symbol in env, it is
unchanged. If it is a promise object, i.e., a formal argument to a
function or explicitly created using delayedAssign(),
the expression slot of the promise replaces the symbol. If it is an
ordinary variable, its value is substituted, unless env is
.GlobalEnv in which case the symbol is left unchanged.

Both quote and substitute are ‘special’
primitive functions which do not evaluate their arguments.

Value

The mode of the result is generally "call" but
may in principle be any type. In particular, single-variable
expressions have mode "name" and constants have the
appropriate base mode.

Note

substitute works on a purely lexical basis. There is no
guarantee that the resulting expression makes any sense.

Substituting and quoting often cause confusion when the argument is
expression(...). The result is a call to the
expression constructor function and needs to be evaluated
with eval to give the actual expression object.