Inserts Figures in appropriate places in Word files
add_plots.Rd
Reads in a .docx file and returns a new version with figures placed at appropriate places in the document.
Arguments
- docx_in
Path to the input .docx file
- docx_out
Path to output .docx to save to
- figures_path
Path to images file directory
- fig_width
Figure width in inches. This is a global controller. Defaults to NULL. If NULL, the size is calculated calculated based on the pixels of the actual figure
- fig_height
Figure height in inches. This is a global controller. Defaults to NULL. If NULL, the size is automatically calculated based on the pixels of the actual figure
- debug
Debug
Examples
if (FALSE) { # \dontrun{
# ---------------------------------------------------------------------------
# Load all dependencies
# ---------------------------------------------------------------------------
docx_in <- file.path(here::here(), "report", "shell", "template.docx")
doc_dirs <- make_doc_dirs(docx_in = docx_in)
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.
# Table addition running add_tables will format and insert tables into the doc.
# ---------------------------------------------------------------------------
add_tables(
docx_in = doc_dirs$doc_in,
docx_out = doc_dirs$doc_tables,
tables_path = tables_path
)
# ---------------------------------------------------------------------------
# Step 3.
# Next we place in the plots using the add_plots function.
# ---------------------------------------------------------------------------
add_plots(
docx_in = doc_dirs$doc_tables,
docx_out = doc_dirs$doc_tabs_figs,
figures_path = figures_path
)
} # }