bquote
Partial Substitution in Expressions

Description

Returns a quoted expression, where the parts of the expression wrapped in .() are evaluated in the environment specified by the where argument.

Usage

bquote(expr, where = parent.frame())

Arguments

expr an expression. Can include terms wrapped in .() indicating that the enclosed term should be evaluated. If this argument is missing, the missing value symbol itself is returned.
where an integer specifying a frame, an environment, or a list of named elements defining the names occurring in the expression. This argument is similar to the envir argument in the function eval.

Details

bquote is similar in function to the LISP macro backquote.
Value
returns an expression similar to the input expression, but with all terms wrapped in .() replaced by their values.
Side Effects
Expressions that are wrapped in .() are evaluated and can have side effects.
See Also
eval, quote, substitute.
Examples
a <- 1
bquote(log(.(a)) == .(log(a)))
# result: log(1) == 0
bquote(log(.(a)) == .(log(a)), list(a = exp(1)))
# result: log(2.71828182845905) == 1
bquote(y ~ .(f)(x), list(f = as.name("log")))
# result: y ~ log(x)
Package base version 4.0.0-28
Package Index