Learn R Programming

wrapr (version 1.9.6)

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

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

Usage

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

Arguments

call

result of match.call()

env

environment to perform lookups in.

Value

name list of values

Details

Note: eagerly evalutes argument and writes them into the function's executing environment.

See Also

bquote_function

Examples

Run this code
# NOT RUN {
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)
  for(nmi in setdiff(ls(),
                     c("captured_call", "captured_args", "env"))) {
    print(paste(nmi, get(nmi)))
  }
  captured_args
}

z <- "x"
y <- 5
qv <- 3

# equivilent to f(3, x = 5)
args <- f(q = .(qv), .(z) := .(y))

print(args)

# }

Run the code above in your browser using DataLab