I'm trying to extract the names of objects that are being mapped over within purrr::map(). Here's a simplified example of the problem.
library(tidyverse)
input <- list(df1 = mtcars, df2 = iris)
map(input, ~ deparse(substitute(.x)))
My SO searches led me to the "deparse(subsitute()" trick. But in this example, it returns
$df1
[1] "..1"
$df2
[1] "..1"
instead of what I want, which is
df1
[1] "df1"
$df2
[1] "df2"
In other words, I need to be able to process the names of the objects in the list within a more elaborate lambda function.
Thanks in advance for any help.