Totals HAI counts by a chosen variable (e.g. infection type, age group, or sex).
Usage
summarise_hai(
data,
by = "Infection_Type",
as_kable = FALSE,
caption = "Summary of HAI cases by selected grouping variable."
)Arguments
- data
A data frame like
hai_data_clean(must include columns: Infection_Type, Age_Group, Sex, Count)- by
The column name to group by: one of
"Infection_Type","Age_Group", or"Sex".- as_kable
Logical. If TRUE, returns a formatted kable table (requires the knitr and kableExtra packages).
- caption
Character. Caption for the table when
as_kable = TRUE.
Examples
data("num_hai_patients_by_stratum", package = "BHAI")
#> Warning: data set ‘num_hai_patients_by_stratum’ not found
# summarise_hai(hai_data_clean, by = "Infection_Type")