| englue {rlang} | R Documentation |
englue() creates a string with the glue operators { and {{. These operators are
normally used to inject names within dynamic dots.
englue() makes them available anywhere within a function.
englue() must be used inside a function. englue("{{ var }}")
defuses the argument var and transforms it to a
string using the default name operation.
englue(x)
x |
A string to interpolate with glue operators. |
englue("{{ var }}") is equivalent to as_label(enquo(var)). It
defuses arg and transforms the expression to a
string with as_label().
In dynamic dots, using only { is allowed. In englue() you must
use {{ at least once. Use glue::glue() for simple
interpolation.
Before using englue() in a package, first ensure that glue is
installed by adding it to your Imports: section.
usethis::use_package("glue", "Imports")
g <- function(var) englue("{{ var }}")
g(cyl)
g(1 + 1)
g(!!letters)
# These are equivalent to
as_label(quote(cyl))
as_label(quote(1 + 1))
as_label(letters)