Just wondering what the current start of the art is for using tidyeval principles inside a function.
Imagine we have two tibbles in our environment, and we want to pass their names to a purrr::map call:
library(tidyverse)
t1 <- tribble(
~name,
"foo"
)
t2 <- t1
To print t1 and t2 via references to their names as strings, this works:
ls() %>%
map(
~get(.x)
)
ut my attempt at more idiomatically tidyeval approaches don't
ls() %>%
map(
~{{.x}}
)
ls() %>%
map(
~enquo(.x)
)
ls() %>%
map(
~sym(.x)
)
These all print the objects' names, not their contents.
How does this working using the tidyeval approach?
ls() |> mget()is probably more direct. Not sure what trying to userlangreally adds to this type of problem.