LISP反引号宏的一种类似物。bquote引用了它的参数,除了在指定的where环境中对包装在()中的术语进行求值。如果splice=TRUE,则对..()中包装的术语求值并将其拼接到调用中。
bquote(expr, where = parent.frame(), splice = FALSE)
expr : 语言对象。
where : 环境。
splice : 逻辑;如果启用了真拼接。
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)