iteratively apply ggplot function within a map function
问题 I would like to generate a series of histograms for all variables in a dataset, but I am clearly not preparing the data correctly for use in the map function. library(tidyverse) mtcars %>% select(wt, disp, hp) %>% map(., function(x) ggplot(aes(x = x)) + geom_histogram() ) I can accomplish this task with a for loop (h/t but am trying to do the same thing within the tidyverse. foo <- function(df) { nm <- names(df) for (i in seq_along(nm)) { print( ggplot(df, aes_string(x = nm[i])) + geom