Write the Contoso business reports to files

Source: R/reports.R

Writes each report from read_reports() as a YAML file named ⁠<id>.yaml⁠, holding the metadata fields and the Markdown text in body. yaml12::read_yaml() reads a file back in one call.

Usage

export_reports(dir, overwrite = FALSE)

Arguments

dir

Directory to write to. Created if it does not exist.

overwrite

Replace files that already exist?

Value

The paths of the written files, invisibly.

Examples

dir <- file.path(tempdir(), "contoso-reports")
paths <- export_reports(dir)
#> Writing 118 report files to '/tmp/RtmpoBKTOx/contoso-reports'.
#> ✔ Wrote 118 files.
yaml12::read_yaml(paths[1])$title
#> [1] "2025 Annual Operating Plan - Summary"
unlink(dir, recursive = TRUE)