View source: R/genetic_diagnosis.R
getDxStatus | R Documentation |
This function is useful for verifying that raw or residual phenotype risk scores of diagnosed individuals (cases) tend to be higher than scores of undiagnosed individuals (controls).
getDxStatus(
demos,
icdOccurrences,
minUniqueAges = 2L,
diseaseDxIcdMap = phers::diseaseDxIcdMap
)
demos |
A data.table having one row per person in the cohort. Must have
a column |
icdOccurrences |
A data.table of occurrences of ICD codes for each
person in the cohort. Must have columns |
minUniqueAges |
Integer indicating the minimum number of unique
ICD code entry ages required to classify a person as a case. Persons with
at least one, but fewer than |
diseaseDxIcdMap |
A data.table of the mapping between diseases and
the corresponding ICD codes that indicate a diagnosis. Must have columns
|
A data.table with columns person_id
, disease_id
, and dx_status
(1 indicates a case, 0 indicates a control, -1 indicates neither).
library('data.table')
icdSample1 = merge(icdSample, demoSample[, .(person_id, dob)], by = 'person_id')
icdSample1[, occurrence_age := as.numeric((entry_date - dob)/365.25)]
icdSample1[, `:=`(entry_date = NULL, dob = NULL)]
dxStatus = getDxStatus(demoSample, icdSample1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.