r-lib / rlang

Low-level API for programming with R
https://rlang.r-lib.org
Other
508 stars 138 forks source link

Weird error message in `englue()` #1531

Closed lionel- closed 1 year ago

lionel- commented 1 year ago
test <- function(data, var) {
  data |>
    mutate(
      col = englue("mpg: {{ var }} and cyl: {cyl}")
    ) |>
    select({{ var }}, cyl, col)
}

mtcars |>
  test(mpg) |>
  head()
#> Error in `mutate()` at dplyr/R/select.R:58:2:
#> ! Problem while computing `col = englue("mpg: {{ var }} and cyl:
#>   {cyl}")`.
#> Caused by error in `rlang::list2()` at rlang/R/eval.R:195:2:
#> ! The LHS of `:=` must be a string or a symbol