Hi, is there a way to generate headings using purrr in rmarkdown documents?
For example with this code in a chunk:
library(tidyverse)
cats <- unique(iris$Species) %>%
set_names()
plots <- function(cat){
ggplot(iris %>% filter(Species == cat),
aes(Sepal.Length, Sepal.Width)) +
geom_point()
}
purrr::map(cats, ~plots(.x))
But with markdown headings in between e.g. (# setosa) - something like this:
I thought I remembered seeing a function in either purrr or rmarkdown that would do something like this, but I can't find it. Any ideas?