20.5 Quosures and ...

Quosures are just a convenience, but they are essential when it comes to working with ..., because you can have each argument from ... associated with a different environment.

g <- function(...) {
  ## Creating our quosures from ...
  enquos(...)
}

createQuos <- function(...) {
  ## symbol from the function environment
  x <- 1
  g(..., f = x)
}
## symbol from the global environment
x <- 0
qs <- createQuos(global = x)
qs
#> <list_of<quosure>>
#> 
#> $global
#> <quosure>
#> expr: ^x
#> env:  global
#> 
#> $f
#> <quosure>
#> expr: ^x
#> env:  0x557c2c7400b8