Learn R Programming

icd9 (version 1.0)

icd9Charlson: Calculate Charlson Comorbidity Index (Charlson Score)

Description

Charlson score is calculated in the basis of the Quan revision of Deyo's ICD-9 mapping. (Peptic Ulcer disease no longer warrants a point.) Quan published an updated set of scores, but it seems most people use the original scores for easier comaprison between studies, even though Quan's were more predictive. TODO: add Quan Charlson score calculation.

Usage

icd9Charlson(x, visitId = NULL, return.df = FALSE,
  stringsAsFactors = getOption("stringsAsFacotrs"), ...)

icd9CharlsonComorbid(x, visitId = NULL, applyHierarchy = FALSE)

Arguments

x

data frame containing a column of visit or patient identifiers, and a column of ICD-9 codes. It may have other columns which will be ignored. By default, the first column is the patient identifier and is not counted. If visitId is not specified, the first column is used.

visitId

The name of the column in the data frame which contains the patient or visit identifier. Typically this is the visit identifier, since patients come leave and enter hospital with different ICD-9 codes. It is a character vector of length one. Defaults to "visitId"

return.df

single logical value, if true, a two column data frame will be returned, with the first column named as in input data frame (i.e. visitId), containing all the visits, and the second column containing the Charlson Comorbidity Index.

stringsAsFactors

single logical, passed on when constructing data.frame if return.df is TRUE. If the input data frame x has a factor for the visitId, this is not changed, but a non-factor visitId may be converted or not converted according to your system default or this setting.

...

further arguments to pass on to icd9ComorbidQuanDeyo, e.g. icd9Field

applyHierarchy

single logical value, default is FALSE. If TRUE, will drop DM if DMcx is present, etc.

Details

Per Quan, "The following comorbid conditions were mutually exclusive: diabetes with chronic complications and diabetes without chronic complications; mild liver disease and moderate or severe liver disease; and any malignancy and metastatic solid tumor.""

Examples

Run this code
# NOT RUN {
mydf <- data.frame(visitId = c("a", "b", "c"),
                   icd9 = c("441", "412.93", "044.9"))
cmb <- icd9ComorbidQuanDeyo(mydf, isShort = FALSE, applyHierarchy = TRUE)
cmb
icd9Charlson(mydf, isShort = FALSE)
icd9Charlson(mydf, isShort = FALSE, return.df = TRUE)
icd9CharlsonComorbid(cmb)
# }

Run the code above in your browser using DataLab