bquote_call_args is a helper to allow the user to write functions with bquote-enabled argument substitution. Uses convetion that := is considered a alias for =. Re-writes call args to evaluate expr with bquote .() substitution. Including .(-x) promoting x's value from character to a name, which is called "quote negation" (hence the minus-sign).

bquote_call_args(call, env = parent.frame())

Arguments

call

result of match.call()

env

environment to perform lookups in.

Value

name list of values

See also

Examples

f <- function(q, ...) { env = parent.frame() # match.call() best called in function context. captured_call <- match.call() captured_args <- bquote_call_args(captured_call, env) captured_args } z <- "x" y <- 5 qv <- 3 # equivalent to f(3, x = 5) f(.(qv), .(z) := .(y))
#> $q #> [1] 3 #> #> $x #> [1] 5 #>
# equivalent to f(q = 7) qname <- 'q' f(.(qname) := 7)
#> $q #> [1] 7 #>