Formats a workflow() result as a gt table with confidence intervals,
CV quality classification, and provenance-based source notes.
Usage
workflow_table(
result,
ci = 0.95,
digits = 2,
compare_by = NULL,
show_cv = TRUE,
show_se = TRUE,
title = NULL,
subtitle = NULL,
source_note = TRUE,
locale = "en",
theme = "publication"
)Arguments
- result
A
data.tablefromworkflow().- ci
Confidence level for intervals (default 0.95). Set to
NULLto hide confidence intervals.- digits
Number of decimal places (default 2).
- compare_by
Column name to pivot for side-by-side comparison (e.g.,
"survey_edition").- show_cv
Logical; show CV column with quality classification.
- show_se
Logical; show SE column.
- title
Table title. Auto-generated if
NULL.- subtitle
Table subtitle. Auto-generated if
NULL.- source_note
Logical; show provenance footer.
- locale
Locale for number formatting (
"en"or"es").- theme
Table theme:
"publication"(clean) or"minimal".
Value
A gt_tbl object. Export via gt::gtsave() to .html, .docx,
.pdf, .png, or .rtx. Falls back to knitr::kable() if gt is not
installed.
Details
CV quality classification follows INE/CEPAL standards:
Excellent: CV < 5\
Very good: 5-10\
Good: 10-15\
Acceptable: 15-25\
Use with caution: 25-35\
Do not publish: >= 35\
Examples
svy <- Survey$new(
data = data.table::data.table(
x = rnorm(100), g = sample(c("a", "b"), 100, TRUE), w = rep(1, 100)
),
edition = "2023", type = "test", psu = NULL,
engine = "data.table", weight = add_weight(annual = "w")
)
result <- workflow(
list(svy), survey::svymean(~x, na.rm = TRUE),
estimation_type = "annual"
)
# \donttest{
if (requireNamespace("gt", quietly = TRUE)) {
workflow_table(result)
}
Survey Estimation Results
Statistic
Estimate
SE
CI Lower
CI Upper
CV (%)
Quality
metasurvey 0.0.21 | CI: 95% | 2026-02-25
# }