19.3 Quote

  • Expression
# for interactive use
rlang::expr(x+y)
#> x + y

# enexpr works on function arguments (looks at internal promise object)  
f2 <- function(x) rlang::enexpr(x)
f2(a + b + c)
#> a + b + c
  • To capture multiple arguments, use enexprs()
f <- function(...) enexprs(...)
f(x=1, y= 10 *z)
#> $x
#> [1] 1
#> 
#> $y
#> 10 * z
  • For symbols, there is ensym and ensyms which check that the argument is a symbol or string.