comorbidity {comorbidity} | R Documentation |
Computes comorbidity scores such as the weighted Charlson score and the Elixhauser comorbidity score.
comorbidity(x, id, code, score, icd = "icd10", assign0, factorise = FALSE, labelled = TRUE, tidy.codes = TRUE)
x |
A tidy data frame with one column containing an individual ID and a column containing all diagnostic codes. |
id |
Column of |
code |
Column of |
score |
The comorbidity score to compute. Possible choices are the weighted Charlson score ( |
icd |
The version of ICD coding to use. Possible choices are ICD-9-CM ( |
assign0 |
Apply a hierarchy of comorbidities. If
|
factorise |
Return comorbidities as factors rather than numeric, where (1 = presence of comorbidity, 0 = otherwise). Defaults to |
labelled |
Attach labels to each comorbidity, compatible with the RStudio viewer via the |
tidy.codes |
Tidy diagnostic codes? If |
The ICD-10 and ICD-9-CM coding for the Charlson and Elixhauser scores is based on work by Quan et al. (2005). Weights for the Charlson score are based on the original formulation by Charlson et al. in 1987, while weights for the Elixhauser score are based on work by Moore et al. and van Walraven et al. Finally, the categorisation of scores and weighted scores is based on work by Menendez et al. See vignette("comorbidityscores", package = "comorbidity")
for further details on the comorbidity scores and the weighting algorithm.
ICD-10 and ICD-9 codes must be in upper case and with alphanumeric characters only in order to be properly recognised; set tidy.codes = TRUE
to properly tidy the codes automatically. As a convenience, a message is printed to the R console when non-alphanumeric characters are found.
A data frame with id
, columns relative to each comorbidity domain, comorbidity score, weighted comorbidity score, and categorisations of such scores, with one row per individual.
For the Charlson score, the following variables are included in the dataset:
The id
variable as defined by the user;
ami
, for acute myocardial infarction;
chf
, for congestive heart failure;
pvd
, for peripheral vascular disease;
cevd
, for cerebrovascular disease;
dementia
, for dementia;
copd
, chronic obstructive pulmonary disease;
rheumd
, for rheumatoid disease;
pud
, for peptic ulcer disease;
mld
, for mild liver disease;
diab
, for diabetes without complications;
diabwc
, for diabetes with complications;
hp
, for hemiplegia or paraplegia;
rend
, for renal disease;
canc
, for cancer (any malignancy);
msld
, for moderate or severe liver disease;
metacanc
, for metastatic solid tumour;
aids
, for AIDS/HIV;
score
, for the non-weighted version of the Charlson score;
index
, for the non-weighted version of the grouped Charlson index;
wscore
, for the weighted version of the Charlson score;
windex
, for the weighted version of the grouped Charlson index.
Conversely, for the Elixhauser score the dataset contains the following variables:
The id
variable as defined by the user;
chf
, for congestive heart failure;
carit
, for cardiac arrhythmias;
valv
, for valvular disease;
pcd
, for pulmonary circulation disorders;
pvd
, for peripheral vascular disorders;
hypunc
, for hypertension, uncomplicated;
hypc
, for hypertension, complicated;
para
, for paralysis;
ond
, for other neurological disorders;
cpd
, for chronic pulmonary disease;
diabunc
, for diabetes, uncomplicated;
diabc
, for diabetes, complicated;
hypothy
, for hypothyroidism;
rf
, for renal failure;
ld
, for liver disease;
pud
, for peptic ulcer disease, excluding bleeding;
aids
, for AIDS/HIV;
lymph
, for lymphoma;
metacanc
, for metastatic cancer;
solidtum
, for solid tumour, without metastasis;
rheumd
, for rheumatoid arthritis/collaged vascular disease;
coag
, for coagulopathy;
obes
, for obesity;
wloss
, for weight loss;
fed
, for fluid and electrolyte disorders;
blane
, for blood loss anaemia;
dane
, for deficiency anaemia;
alcohol
, for alcohol abuse;
drug
, for drug abuse;
psycho
, for psychoses;
depre
, for depression;
score
, for the non-weighted version of the Elixhauser score;
index
, for the non-weighted version of the grouped Elixhauser index;
wscore_ahrq
, for the weighted version of the Elixhauser score using the AHRQ algorithm (Moore et al., 2017);
wscore_vw
, for the weighted version of the Elixhauser score using the algorithm in van Walraven et al. (2009);
windex_ahrq
, for the weighted version of the grouped Elixhauser index using the AHRQ algorithm (Moore et al., 2017);
windex_vw
, for the weighted version of the grouped Elixhauser index using the algorithm in van Walraven et al. (2009).
Labels are presented to the user when using the RStudio viewer (e.g. via the utils::View()
function) for convenience.
Quan H, Sundararajan V, Halfon P, Fong A, Burnand B, Luthi JC, et al. Coding algorithms for defining comorbidities in ICD-9-CM and ICD-10 administrative data. Medical Care 2005; 43(11):1130-1139.
Charlson ME, Pompei P, Ales KL, et al. A new method of classifying prognostic comorbidity in longitudinal studies: development and validation. Journal of Chronic Diseases 1987; 40:373-383.
Moore BJ, White S, Washington R, Coenen N, and Elixhauser A. Identifying increased risk of readmission and in-hospital mortality using hospital administrative data: the AHRQ Elixhauser comorbidity index. Medical Care 2017; 55(7):698-705.
van Walraven C, Austin PC, Jennings A, Quan H and Forster AJ. A modification of the Elixhauser comorbidity measures into a point system for hospital death using administrative data. Medical Care 2009; 47(6):626-633.
Menendez ME, Neuhaus V, van Dijk CN, Ring D. The Elixhauser comorbidity method outperforms the Charlson index in predicting inpatient death after orthopaedic surgery. Clinical Orthopaedics and Related Research 2014; 472(9):2878-2886.
set.seed(1) x <- data.frame( id = sample(1:15, size = 200, replace = TRUE), code = sample_diag(200), stringsAsFactors = FALSE ) # Charlson score based on ICD-10 diagnostic codes: comorbidity(x = x, id = "id", code = "code", score = "charlson", assign0 = FALSE) # Elixhauser score based on ICD-10 diagnostic codes: comorbidity(x = x, id = "id", code = "code", score = "elixhauser", assign0 = FALSE)