Skip to content

Instantly share code, notes, and snippets.

@b-rodrigues
Forked from georoen/create_pptx.R
Created April 12, 2020 19:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b-rodrigues/ef4e97ed75028ca1ddd5987bb4085c1c to your computer and use it in GitHub Desktop.
Save b-rodrigues/ef4e97ed75028ca1ddd5987bb4085c1c to your computer and use it in GitHub Desktop.
updated create_pptx
# modified from https://www.brodrigues.co/blog/2018-10-05-ggplot2_purrr_officer/
create_pptx <- function(plt = last_plot(), path = file.choose()){
if(!file.exists(path)) {
out <- read_pptx()
} else {
out <- read_pptx(path)
}
out %>%
add_slide(layout = "Title and Content", master = "Office Theme") %>%
ph_with(value = dml(ggobj = plt), location = ph_location_fullsize()) %>%
print(target = path)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment