body_replace_gg_at_bkm: Replace a plot at a bookmark location

Description Usage Arguments Value Examples

View source: R/internal_functions.R

Description

Replace a plot at a bookmark location saving it as a PNG file in a temporary folder.
A bookmark will be considered as valid if enclosing words within a paragraph; i.e., a bookmark along two or more paragraphs is invalid, a bookmark set on a whole paragraph is also invalid, but bookmarking few words inside a paragraph is valid.

Usage

1
body_replace_gg_at_bkm(doc, gg, bookmark, width = 6, height = 3)

Arguments

doc

a docx device

gg

a ggplot object or any object that can be printed in grDevices::png()

bookmark

bookmark id

width

the width of the device in inches

height

the height of the device.

Value

doc

Examples

1
2
3
4
5
6
7
8
doc <- officer::read_docx(path = file.path(system.file(package = "EpiReport"),
                                           "template/AER_template.docx" ))
p <- EpiReport::getTrend()
doc <- EpiReport::body_replace_gg_at_bkm(doc = doc,
                                         gg = p,
                                         bookmark = "TS_TREND",
                                         width = 6,
                                         height = 3)

EU-ECDC/EpiReport documentation built on Feb. 11, 2021, 6:30 p.m.