I want to iterate through a group of dataframes, and one of the values I want to return is the name of the dataframe. I defined a function using rlang::ensym() and rlang::as_label() that works when applied to a single object, but does not work with purrr::map().
Reproducible example:
function1 <- function(input) {
return(rlang::as_label(rlang::ensym(input)))
}
input1 <- "a"
function1(input1) ## returns "input1"
output1 <- purrr::map(list(input1), ~function1(.))
output1[[1]] ## returns "." want it to return "input1"
output2 <- purrr::map(list(input1), function(x) function1(x))
output2[[1]] ## returns "x" want it to return "input1"