Description Usage Arguments Details Note Author(s) Examples
to_ppt allows you to pass R objects to an open pptWorkbook,
and write it later with write_data. The pptWorkbook can be created
by calling ppt_workbook. to_ppt will always format
the output and add it to a new slide.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | to_ppt(x, wb, title = NULL, subtitle = NULL)
ppt_workbook(template = NULL, font = "Calibri", fontsize = 10L)
## S3 method for class 'data.frame'
to_ppt(x, wb, title = NULL, subtitle = NULL)
## S3 method for class 'FlexTable'
to_ppt(x, wb, title = NULL, subtitle = NULL)
## S3 method for class 'ggplot'
to_ppt(x, wb, title = NULL, subtitle = NULL)
## S3 method for class 'character'
to_ppt(x, wb, title = NULL, subtitle = NULL)
|
x |
A |
wb |
A |
title |
Title to use for the new slide. Defaults to a single whitespace when
title is |
subtitle |
The subtitle for the slide. When |
template |
Optional: Specify a path if you would like to append slides to an existing powerpoint file (use it as a template). Default uses the template included in this package. |
font |
Default font (Replaces the |
fontsize |
Default fontsize (Replaces the |
You can use this function to pass plot, data.frame (table and
matrix will be coerced), and character objects to the workbook.
Strings are assumed to be markdown.
This function requires ReporteRs. The pptWorkbook object
is a thin R6 wrapper around ReporteR's pptx, and allow us to use
to_ppt in chained expressions, since the workbook is mutable.
Kristian D. Olsen
1 2 3 4 5 6 7 8 9 10 11 12 13 | if (require(ReporteRs)) {
wb <- ppt_workbook()
df <- data.frame("String" = c("A", "B"), "Int" = c(1:2L), "Percent" = c(0.5, 0.75))
# The workbook is mutable, so we don't have to assign result.
to_ppt(df, wb, title = "Example data", subtitle = "")
# Data is first argument, so we can use it with dplyr.
# df %>% to_ppt(wb, title = "Example data", subtitle = "")
# Save the data
write_data(wb, "Example table.pptx")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.