Skip to contents

Turns 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.

Usage

report_deck(
  items,
  path = NULL,
  format = c("pptx", "docx"),
  title = NULL,
  template = NULL,
  style = c("elevated", "plain")
)

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) writes report.pptx / report.docx. A bare file name lands in ezrsurvey-outputs/ (created on demand); a path naming a directory ("./x.pptx", "charts/x.pptx", anything absolute) is used exactly as given. See the output_dir option.

format

"pptx" (default) or "docx".

title

Optional title-slide / document-title text.

template

Optional reference document; NULL (default) uses the brand template registered by use_brand(), see report_new().

style

Built-in template to fall back on: "elevated" (default, the styled deck) or "plain" (undecorated white). See report_new().

Value

Invisibly path.

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")