grab_assignments_from_dots: Re-write captured '...' arguments as assignments.

Description Usage Arguments Value Examples

View source: R/unpack.R

Description

Re-write captured ... arguments as a c(DESTINATION = TARGET) character vector. Suggested capture code is: substitute(list(...)). Allows bquote .() substitution.

Usage

1
2
3
4
5
grab_assignments_from_dots(
  captured_args,
  unpack_environment = parent.frame(),
  allow_dot_on_left = FALSE
)

Arguments

unpack_environment

environment to look in

allow_dot_on_left

logical if TRUE allow forms like .(a) = a and .(a).

captured_dots

captured ....

Value

named character vector describing the desired mapping.

Examples

1
2
3
4
5
6
7
f <- function(...) {
  unpack_environment <- parent.frame(n = 1)
  orig_args <- substitute(list(...))
  grab_assignments_from_dots(orig_args, unpack_environment)
}
f(a, c = d, e := f, g <- h, i -> j)
# should equal c('a', 'c' = 'd', 'e' = 'f', 'g' = 'h', 'j' = 'i')

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