my_dfs <- list(
mtcars = mtcars,
diamonds = diamonds
)
map(.x = my_dfs, ~ print(.x %>% str)) # OK
But if I also want to access the name of the item in the list being printed, how can I do that?
map(.x = my_dfs, ~ print(.id)) # found a reference to .id in the docs.
Error in print(.id) : object '.id' not found
Better yet, I would like both in one call to map, e.g.
map(.x = my_dfs, ~ print('About to print str of ' [somehow get list item name here] .x %>% str))