Get a person's most recent state/province
get_person_state_province.Rd
A helper function primarily used by table_one()
to calculate a person's
most recent state/province.
Approximate each patient's geographic location by calculating the state or province where each patient most commonly received care during a certain number of years preceding their most recent visit. If multiple states or provinces have the same number of visits for a patient, the state/province with the most recent visit is selected.
Value
A data frame, one row per patient, with columns person_id
,
state_province
(two-character state/province codes),
state_region
(US Census Region), and state_division
(US Census Division).
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 state_province
. See examples.
See also
get_concept_names()
, get_observation_periods()
, get_person_age()
,
get_person_clinical_document_span()
, get_person_enrollment_date()
,
get_person_ethnicity()
, get_person_hospitalization_info()
,
get_person_num_care_sites()
, get_person_num_providers()
,
get_person_race()
, get_person_sex()
, get_person_state_province()
,
get_person_visit_span()
, table_one()