Hi folks,
I would like to refer to a variable when the name of it comes from the value of another variable. Weird stuff, I assume, but it appeared in a real case. Any ideas? Thanks!
da <- tibble::tibble(x = "name", name = 10)
da |>
dplyr::summarise(result = name)
#> # A tibble: 1 × 1
#> result
#> <dbl>
#> 1 10
da |>
dplyr::summarise(result = .data[[x]])
#> Error in splice(dot_call(capture_dots, frame_env = frame_env, named = named, : objeto 'x' não encontrado
Created on 2022-09-24 with reprex v2.0.2