Calculate the span of data between first and last visits
get_person_visit_span.Rd
A helper function primarily used by table_one()
to calculate the span in
years between the first and last visit per person. It does not take into
account gaps in the record, for something like that one should explore the
get_observation_periods()
function.
Value
A data frame, one row per person, with a column for person_id
and
visit_span
, i.e. the years between the first and last visit for a person
and, if specified, the start and end dates of the span, i.e.
span_start_date
and span_end_date
.
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 visit_span
and
optionally, span_start_date
and span_end_date
. 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()