This is a pretty common operation in my toolbox. I want a pure tidyverse solution without using a character.
suppressWarnings(library(tidyverse))
tibble(a=1) %>% pluck('a')
#> [1] 1
tibble(a=1) %>% pluck(a)
#> Error in list2(...): object 'a' not found
Created on 2023-01-10 by the reprex package (v2.0.1)
We may use pull
tibble(a =1) %>%
pull(a)
[1] 1
Or if we want to use pluck
tibble(a=1) %>%
pluck(deparse(substitute(a)))
[1] 1