bquote_call_args: Treat ... argument as bquoted-values.

Description Usage Arguments Value See Also Examples

View source: R/bquotefn.R

Description

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).

Usage

1

Arguments

call

result of match.call()

env

environment to perform lookups in.

Value

name list of values

See Also

bquote_function

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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))

# equivalent to f(q = 7)
qname <- 'q'
f(.(qname) := 7)

WinVector/wrapr documentation built on Nov. 21, 2020, 8:31 p.m.