Add and save report
Reporter.Rd
Add report to a report.json to pipen-report to build a report
Methods
Method add2()
Add a content to the report, but infer the headings from headings and sub-headings
Usage
Reporter$add2(..., hs, hs2 = c(), ui = "flat", collapse = ": ")
Arguments
...
The content to add
hs
The headings of the case
hs2
The headings that must be shown. When there are more items in
hs
, they will be concatenated. For example, ifhs = c("Section1", "Case1")
, andhs2 = c("A", "B")
, then headings will beh1 = "Section1: Case1"
andh2 = "A"
andh3 = "B"
.ui
The user interface of the report
collapse
The separator to concatenate the headings
Method image()
Generate a report for an image to be added
Arguments
prefix
The prefix of the image
more_formats
More formats of the image available
save_code
Whether to save the code to reproduce the plot
kind
The kind of the report, default is "image"
...
Other arguments to add to the report
Examples
reporter <- get_reporter()
reporter$add(
list(
name = "Image 1",
contents = list(reporter$image("/path/to/image1", "pdf", save_code = TRUE))
),
h1 = "Images",
h2 = "Image 1"
)
Method save()
Save the report to a file
Examples
## ------------------------------------------------
## Method `Reporter$image`
## ------------------------------------------------
reporter <- get_reporter()
reporter$add(
list(
name = "Image 1",
contents = list(reporter$image("/path/to/image1", "pdf", save_code = TRUE))
),
h1 = "Images",
h2 = "Image 1"
)