Skip to contents

Writes a deck or document built with report_new() and the report_* verbs, and returns the path it used, so a build pipeline can carry on from it.

Usage

report_save(doc, path = NULL)

Arguments

doc

A document from report_new().

path

Output file path (.pptx or .docx). 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.

Value

Invisibly path.

Details

The format follows the document, not the file name: a deck writes .pptx and a Word document writes .docx, which is why path may be left out entirely. Where the file lands follows the same rule as every other ezrsurvey save, so a bare name collects in the outputs folder with the rest of a session's results and a path naming a directory goes exactly there.

Examples

tmp <- tempfile(fileext = ".pptx")
report_new("pptx") %>% report_add_slide("Hi") %>% report_save(tmp)
file.exists(tmp)
#> [1] TRUE

# a bare name instead lands in ezrsurvey-outputs/:
# report_new("pptx") %>% report_add_slide("Hi") %>% report_save("deck.pptx")