Created
July 24, 2018 14:27
-
-
Save PaulC91/855cd1b99b6b86d25976d15a13fd97db to your computer and use it in GitHub Desktop.
Create multiple parameterised powerpoint reports using rmarkdown and purrr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rmarkdown) | |
library(ggplot2) | |
library(purrr) | |
ppt_render <- function (data) { | |
params <- list(data = data) | |
group <- unique(data$class) | |
rmarkdown::render("report.Rmd", output_file = paste0("mpg_", group, ".pptx"), params = params) | |
} | |
data_groups <- unique(mpg$class) | |
data_groups %>% | |
map(~ mpg %>% filter(class == .x)) %>% | |
walk(ppt_render) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Create multiple PowerPoint Decks with `rmarkdowan` & `purrr`" | |
author: Paul Campbell | |
date: July 24, 2018 | |
output: powerpoint_presentation | |
--- | |
```{r plot, echo=FALSE} | |
library(ggplot2) | |
ggplot(params$data, aes(displ, hwy)) + | |
geom_point() + | |
labs(title = paste("Class:", unique(params$data$class))) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment