build_cohort: Converts a longitudinal data set from e.g. 'prev_terms' to a...

Description Usage Arguments

View source: R/cohort.R

Description

Converts a longitudinal data set from e.g. prev_terms to a cohort dataset. The dataset has a single row for each patient and includes only patients in the numerator or denominator for whichever cohort type is chosen. Columns are added for start and end dates and for start and end times as integer differences from the cohort start date. A binary column is added for membership of the case group. All patients with start date > end date are removed from the dataset.

Usage

1
2
build_cohort(dat, cohort_type = c("incid", "prev"), cohort_start, cohort_end,
  diagnosis_start = "eventdate")

Arguments

dat

dataframe as output from a call to prev_terms

cohort_type

character either 'incid' or 'prev'. This selects the numerators and denominators for that type of cohort

cohort_start

ISO date character string for the start of the cohort

cohort_end

ISO date character string for the end of the cohort

diagnosis_start

character string for the name of the diagnosis variable used to define the start dates, or NULL if the diagnosis date is not to be included in the definition of start dates.


rOpenHealth/rEHR documentation built on March 19, 2018, 7:58 a.m.