
Create Exposure and Optional Response Groups from Diagnoses
Source:R/population_classification.R
classify_population.RdThis function identifies individuals with exposure diagnoses (and optionally response diagnoses) based on ICD-10/9/8 codes and selected registry sources. It returns a dataset of grouped individuals with exposure (and optionally response) classifications, diagnosis dates, and relevant metadata. Function searches first diagnose date, which is given for exposure/response diagnose date.
Arguments
- exposure_icd10
A character vector of ICD-10 codes (regex-supported) to identify exposure group.
- exposure_icd9
A character vector of ICD-9 codes (regex-supported) to identify exposure group.
- exposure_icd8
A character vector of ICD-8 codes (regex-supported) to identify exposure group.
- exposure_src
A character vector of registry sources used to search for exposure diagnoses.
- response_icd10
Optional character vector of ICD-10 codes for response group (default: NULL).
- response_icd9
Optional character vector of ICD-9 codes for response group (default: NULL).
- response_icd8
Optional character vector of ICD-8 codes for response group (default: NULL).
- response_src
A character vector of registry sources used to search for response diagnoses.
- data_population
A data frame of the target population (default: `population`).
- data_diagnoses
A data frame of diagnoses (default: `diagnoses`).
- runtime_shiny
Logical; if TRUE and run inside a Shiny app, shows progress bar (default: FALSE).
Value
A data frame with exposure (and optionally response) group classifications and metadata, including ID, birth/death/migration dates, diagnosis info, and binary indicators for exposure/response.
Examples
classify_population(exposure_icd10 = "I21", exposure_src = "hilmo")
#> Error in classify_population(exposure_icd10 = "I21", exposure_src = "hilmo"): object 'diagnoses' not found
classify_population(exposure_icd10 = "F32", response_icd10 = "I21")
#> Error in classify_population(exposure_icd10 = "F32", response_icd10 = "I21"): object 'diagnoses' not found