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