Updates a Word file to include formatted plots, tables, and footnotes
build_report.Rd
Reads in a .docx file and returns an updated version with plots, tables, and footnotes replaced.
Usage
build_report(
docx_in,
docx_out = NULL,
figures_path,
tables_path,
standard_footnotes_yaml = NULL,
add_footnotes = TRUE,
include_object_path = FALSE,
footnotes_fail_on_missing_metadata = TRUE
)
Arguments
- docx_in
Path to input .docx to update
- docx_out
Path to output .docx to save to
- figures_path
Path to images file directory
- tables_path
Path to tables file directory
- standard_footnotes_yaml
Path to standard_footnotes.yaml in report
- add_footnotes
boolean for including footnotes in the document or not
- include_object_path
boolean for including object path in footnotes
- footnotes_fail_on_missing_metadata
Boolean for allowing objects to lack metadata and thus have no footnotes
Examples
if (FALSE) { # \dontrun{
# ---------------------------------------------------------------------------
# Load all dependencies
# ---------------------------------------------------------------------------
docx_in <- file.path(here::here(), "report", "shell", "template.docx")
figures_path <- file.path(here::here(), "OUTPUTS", "figures")
tables_path <- file.path(here::here(), "OUTPUTS", "tables")
footnotes <- file.path(here::here(), "report", "standard_footnotes.yaml")
# ---------------------------------------------------------------------------
# Step 1.
# Run the wrapper function to replace figures, tables, and footnotes in a
# .docx file.
# ---------------------------------------------------------------------------
build_report(
docx_in = docx_in,
docx_out = doc_dirs$doc_draft,
figures_path = figures_path,
tables_path = tables_path,
standard_footnotes_yaml = footnotes
)
} # }