Learn R Programming

wrapr (version 1.9.6)

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

Description

Re-write captured ... arguments as a c(DESTINATION = TARGET) character vector. Suggested capture code is: as.list(do.call(bquote, list(substitute(list(...)))))[-1]

Usage

grab_assignments_from_dots(captured_dots)

Arguments

captured_dots

captured ....

Value

named character vector describing the desired mapping.

Examples

Run this code
# NOT RUN {
f <- function(...) {
  unpack_environment <- parent.frame(n = 1)
  captured_dots <- as.list(do.call(bquote,
                                   list(substitute(list(...)),
                                        where = unpack_environment),
                                   envir = unpack_environment))[-1]
  grab_assignments_from_dots(captured_dots)
}
f(a, c = d, e := f, g <- h, i -> j)
# should equal c('a', 'c' = 'd', 'e' = 'f', 'g' = 'h', 'j' = 'i')

# }

Run the code above in your browser using DataLab