Learn R Programming

covr (version 4.0.0)

report_html: A coverage report to include in other documents

Description

report_html() creates the coverage report shown by report() as HTML that can be included in a larger document, such as an R Markdown or Quarto document or a page made with htmltools. Printing it in an R Markdown or Quarto chunk includes the report in the document; printing it in the console shows it in the viewer.

Usage

report_html(x = package_coverage())

Value

An htmltools::tagList(), with the dependencies of the report attached.

Arguments

x

a coverage dataset, defaults to running package_coverage().

Details

The report takes the width of the element it is in, and its styles and scripts only apply to the report, so they don't change the rest of the document. A document can include several reports.

The colors and the dark theme can be changed as described in report().

Examples

Run this code
if (FALSE) {
# In an R Markdown or Quarto chunk
report_html(package_coverage())

# Save it with other content
htmltools::save_html(
  htmltools::tagList(
    htmltools::h1("Package review"),
    report_html(package_coverage())
  ),
  "review.html"
)
}

Run the code above in your browser using DataLab