Skip to contents

A helper function primarily used by table_one() to calculate the number of hospitalizations and hospitalization days per person. Note that if the visit table specifies both Inpatient and ER visits, both types will be included.

Usage

get_person_hospitalization_info(ds)

Arguments

ds

A PicnicHealth data set list object.

Value

A data frame, one row per person, with columns describing hospitalization info.

Details

Beyond its use in table_one(), this function may be useful to add an additional column to an existing analytic data.frame that already contains person_id using dplyr::left_join() to include num_hospitalizations and hospitalizations_days. See examples.

Examples

if (FALSE) { # \dontrun{
# Add `num_hospitalizations` and `hospitalizations_days` to an analytic data set that contains `person_id`:
analytic_dataset %>%
  left_join(get_person_hospitalization_info(ds))
} # }