
Build a slide deck from a list of plots and tables in one call
Source:R/report_deck.R
report_deck.RdTurns a named list of ggplots / data frames into a titled-slide deck (or Word document) and saves it. Names become slide titles; each item lands on its own slide, sized to the template's content placeholder.
Arguments
- items
A named list; names become slide titles. Each element is either a ggplot (added as a plot) or a data frame (added as a table).
- path
Output file path.
NULL(default) writesreport.pptx/report.docx. A bare file name lands inezrsurvey-outputs/(created on demand); a path naming a directory ("./x.pptx","charts/x.pptx", anything absolute) is used exactly as given. See theoutput_diroption.- format
"pptx"(default) or"docx".- title
Optional title-slide / document-title text.
- template
Optional reference document;
NULL(default) uses the brand template registered byuse_brand(), seereport_new().- style
Built-in template to fall back on:
"elevated"(default, the styled deck) or"plain"(undecorated white). Seereport_new().
Details
Every chart is rendered at the exact size of the template's content
placeholder and centred in it, and plot_bars() draws bars to a constant
thickness whatever the category count, so the deck reads consistently as you
flick through it.
For a deck built a slide at a time, with section dividers and per-slide
control over the layout, use report_new() and the report_add_*() family
instead.
Examples
# \donttest{
tmp <- tempfile(fileext = ".pptx")
report_deck(
list(
"Gender" = plot_bars(calc_percentage(podracing_survey, demo_gender)),
"NPS" = calc_nps(podracing_survey, nps_value)
),
path = tmp
)
file.exists(tmp)
#> [1] TRUE
# }
# a bare name instead lands in ezrsurvey-outputs/:
# report_deck(items, path = "overview.pptx")