Render a .textSection object as a temporary HTML report to check whether
the section text and code can be rendered successfully.
Arguments
- x
A
.textSectionobject, usually created withreportSection().- object
An optional
camReportobject created bycamData(). The default isNULL.- view
A logical value (default
TRUE) specifying whether the rendered temporary HTML file is opened after rendering.
Details
This function is mainly used to test custom report sections before they are
added to a full camReport report. It checks whether
the
section text, R Markdown chunk settings, required packages, and R code can be
rendered successfully.
The object argument is only needed when the R code in the section refers to
a camReport object.
See also
camData(), reportSection(), updateReportSection(), report()
Other report sections:
reportSection,character-method,
section_names(),
updateReportSection()
Examples
tx <- reportSection(
name = "introduction",
title = "Introduction",
parent = NULL,
txt = "This is an introduction section.",
code = {
plot(1:10)
}
)
# Render the section without opening a browser
test_file <- testSection(
tx,
view = FALSE
)
file.exists(test_file)
#> [1] TRUE
# Remove the generated HTML file
unlink(test_file)