Count sampled discharges and distinct hospital-years for each cell. Rows need valid hospital and year identifiers. A DuckDB input returns only grouped counts to R.
Arguments
- .data
Record-level data frame, lazy DuckDB query, or result of
nis_design().- by
<tidy-select> Cell-defining columns. Omit or select no columns for overall counts. Use name-based selectors on DuckDB queries. The summary names
nandhospitalsare reserved.
Value
A data frame with the columns in by, n (unweighted discharges),
and hospitals (distinct year-scoped hospitals).
See also
Check disclosure before sharing results.
Other disclosure:
nis_scan_outputs(),
nis_suppress()
Examples
nis <- nis_open(nis_example(2020))
nis_cell_counts(nis, by = DQTR)
#> # A tibble: 4 × 3
#> DQTR n hospitals
#> <int> <dbl> <dbl>
#> 1 1 24 12
#> 2 2 24 12
#> 3 3 24 12
#> 4 4 24 12