bquote {base} | R Documentation |
An analogue of the LISP backquote macro. bquote
quotes its
argument except that terms wrapped in .()
are evaluated in the
specified where
environment. If splice = TRUE
then
terms wrapped in ..()
are evaluated and spliced into a call.
bquote(expr, where = parent.frame(), splice = FALSE)
expr |
|
where |
An environment. |
splice |
Logical; if |
require(graphics)
a <- 2
bquote(a == a)
quote(a == a)
bquote(a == .(a))
substitute(a == A, list(A = a))
plot(1:10, a*(1:10), main = bquote(a == .(a)))
## to set a function default arg
default <- 1
bquote( function(x, y = .(default)) x+y )
exprs <- expression(x <- 1, y <- 2, x + y)
bquote(function() {..(exprs)}, splice = TRUE)