Mask a summary using unweighted counts and contributing hospitals.
Usage
nis_suppress(
.data,
threshold = 10,
...,
count_col,
weighted_cols = NULL,
by = NULL,
secondary = TRUE,
hospital_col = NULL
)Arguments
- .data
A
gtsummary::tbl_svysummary()result, optionally withadd_p()oradd_overall(), or a data frame/tibble.- threshold
Maximum unweighted cell count to suppress.
- ...
Reserved for compatibility; unused arguments are errors.
- count_col
<tidy-select> For data frames, select exactly one unweighted-count column.
- weighted_cols
<tidy-select> For data frames, other columns to mask on primary and secondary rows.
- by
<tidy-select> Optional data-frame grouping columns defining strata for complementary suppression.
- secondary
Apply complementary suppression. For data frames this masks the smallest remaining positive count when exactly one row in a stratum is primary-masked. This is single-dimension complementary suppression, not a full cell-suppression solver; totals rows must be handled or excluded by the user.
- hospital_col
<tidy-select> Optional selection of a single data-frame column containing the number of distinct contributing hospitals for each cell. Cells with fewer than two hospitals are marked
<2 hospitals. Missing or invalid hospital counts are errors. Hospital identifiers must be counted by year;nis_cell_counts()computes counts from record-level data or annis_design()result.
Value
For data frames, the same table with masked columns converted to
character. For gtsummary results, the table with primary and secondary
masks and a footnote describing them.
Details
In a survey table, each statistic is checked against its supporting discharges and hospital-years. The function stops when it cannot identify the records behind a statistic. It also checks the non-missing complement of a displayed two-level indicator and can mask related overall statistics. If one categorical level in a column is masked, the function also masks the smallest remaining positive level. Review other deductions from related outputs before release.
In a data frame, supply unweighted counts and, when available, distinct hospital counts. Grouped complementary suppression can mask an additional positive cell when there is one primary mask in a group. Review totals and any other cells that someone could recover by subtraction.
See also
Check disclosure before sharing results.
Other disclosure:
nis_cell_counts(),
nis_scan_outputs()
Examples
nis <- nis_open(nis_example(years = 2019:2020)) |>
nis_flag_dx(heart_failure = "I50")
design <- nis_design(nis, heart_failure, keep = c(AGE, FEMALE, RACE))
table <- gtsummary::tbl_svysummary(
design,
by = RACE,
include = c(AGE, FEMALE)
)
nis_suppress(table, threshold = 10)
Characteristic
White
N = 191,2
Black
N = 211,2
Hispanic
N = 211,2
Asian or Pacific Islander
N = 201,2
Native American
N = 221,2
Other
N = 221,2
1 Median (Q1, Q3); n (%)
2 Statistics based on unweighted n ≤10 are marked ≤10; cells contributed by fewer than two distinct year-scoped hospitals are marked '<2 hospitals', regardless of count. The discharge-count mask takes precedence when both rules apply. Dichotomous rows with a protected complement are marked 'Masked' when the displayed event passes both rules. When a categorical variable has one masked level in a column, the smallest remaining positive level is marked 'Masked'. Before sharing under the HCUP Data Use Agreement, review tables for other derivable cells.
nis <- nis_open(nis_example(2020))
cells <- nis_cell_counts(nis, by = DQTR)
nis_suppress(cells, count_col = n, hospital_col = hospitals, by = DQTR)
#> # A tibble: 4 × 3
#> DQTR n hospitals
#> <int> <chr> <chr>
#> 1 1 24 12
#> 2 2 24 12
#> 3 3 24 12
#> 4 4 24 12