Produces a polished, single-file HTML report summarising a
ks_comparison. The output uses htmltools for layout and reactable
for interactive tables. No internet access, no Quarto, and no Pandoc
are required.
Usage
ks_report_html(
x,
path = NULL,
title = "ksCompare report",
subtitle = NULL,
max_rows = 100L,
theme = c("default", "slate"),
group_by_key = FALSE,
max_groups = 200L
)Arguments
- x
A
ks_comparisonobject.- path
File path for the report. Three behaviours:
missing /
NULL(default): a filename is auto-generated from the comparison'sbase_name(and, when distinct,comp_name) written intooptions$path(if set onks_comp_options()) or the current working directory, e.g.ksCompare_adsl_vs_adsl_qc.html.NA: nothing is written; the assembledhtmltools::tagList()is returned for embedding in another document.a character path: written to that path. A
.htmlextension is appended if missing. A bare filename (no directory component) is resolved relative tooptions$pathwhen that has been set onks_comp_options(), otherwise relative to the working directory.
- title
Title shown at the top of the report.
- subtitle
Optional subtitle (e.g. study identifier or run id).
- max_rows
Per-table row cap (default
100). When the value-diff table exceeds this cap, the report shows a smart stratified sample covering each column and each distinct diff-cause (note), prioritising the largest numeric magnitudes (at least one example per column and per cause is always retained). A notice indicates the sample size and recommendsas_tibble(cmp)for the full set.as_tibble(x)is never truncated.- theme
One of
"default"(steel blue) or"slate"(neutral dark headers on light background).- group_by_key
Logical (default
FALSE). WhenTRUEand aby =key was used inks_compare(), the value-diff section is rendered as one collapsed<details>block per key value, sorted by number of diffs (most-affected first). Fordup_keys = "keep_all"/"all_pairs", each block also shows a Pair column so you can tell pairs apart. Silently falls back to the flat table when noby =was supplied (position match).- max_groups
Maximum number of key-value blocks to render when
group_by_key = TRUE(default200). Excess groups are summarised in a closing notice.
Details
Layout: a left-hand sticky table of contents, a header with dataset
names, a status pill, KPI cards, then sections for schema, row diff,
value diff, patterns, and the run manifest. Tables use
friendly column labels, column groups, and tick/cross markers
instead of raw TRUE/FALSE.
Examples
if (FALSE) { # \dontrun{
cmp <- ks_compare(iris, iris, by = "Species")
# Explicit path
ks_report_html(cmp, "report.html", title = "ADSL QC")
# Auto-generated filename in working directory
ks_report_html(cmp)
# In-memory tagList for embedding
tags <- ks_report_html(cmp, path = NA)
} # }
