The ... syntax of base R allows you to:
Forward arguments from function to function, matching them along the way to function parameters.
Collect arguments inside data structures, e.g. with c() or
list().
Dynamic dots offer a few additional features:
If your function takes dots, adding support for dynamic features is
as easy as collecting the dots with list2() instead of list().
Other dynamic dots collectors are dots_list(), which is more
configurable than list2(), vars() which doesn't force its
arguments, and call2() for creating calls.
Document dynamic docs using this standard tag:
@param ... <[`dynamic-dots`][rlang::dyn-dots]> What these dots do.
f <- function(...) { out <- list2(...) rev(out) } # Splice x <- list(alpha = "first", omega = "last") f(!!!x)#> $omega #> [1] "last" #> #> $alpha #> [1] "first" #># Unquote a name, showing both the `!!` bang bang and `{}` glue style nm <- "key" f(!!nm := "value")#> $key #> [1] "value" #>f("{nm}" := "value")#> $key #> [1] "value" #>f("prefix_{nm}" := "value")#> $prefix_key #> [1] "value" #># Tolerate a trailing comma f(this = "that", )#> $this #> [1] "that" #>