Learn R Programming

icd9 (version 0.5)

icd9Comorbidities: find comorbidities from ICD-9 codes.

Description

This is the main function which extracts co-morbidities from a set of ICD-9 codes. This is when some trivial post-processing of the comorbidity data is done, e.g. renaming to human-friendly field names, and updating fields according to rules. The exact fields from the original mappings can be obtained using applyHierarchy = FALSE, but for comorbidity counting, Charlson Score, etc., the rules should be applied.

For Charlson-based comorbidities, strictly speaking, there is no dropping of more e.g. uncomplicated DM if complicated DM exists, however, this is probaably useful, in general and is essential when calculating the Charlson score.

Usage

icd9Comorbidities(icd9df, visitId = "visitId", icd9Field = "icd9", isShort,
  icd9Mapping, validateMapping = FALSE, isShortMapping = TRUE)

icd9ComorbiditiesAhrq(icd9df, visitId = "visitId", icd9Field = "icd9", isShort, validateMapping = FALSE, abbrevNames = TRUE, applyHierarchy = TRUE)

icd9ComorbiditiesQuanDeyo(icd9df, visitId = "visitId", icd9Field = "icd9", isShort, validateMapping = FALSE, abbrevNames = TRUE, applyHierarchy = TRUE)

icd9ComorbiditiesQuanElixhauser(icd9df, visitId = "visitId", icd9Field = "icd9", isShort, validateMapping = FALSE, abbrevNames = TRUE, applyHierarchy = TRUE)

icd9ComorbiditiesElixhauser(icd9df, visitId = "visitId", icd9Field = "icd9", isShort, validateMapping = FALSE, abbrevNames = TRUE, applyHierarchy = TRUE)

Arguments

icd9df
data frame containing columns for visitId (which is the feault name), icd9 (default for the icd9 code), and maybe also a POA flag.
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 "
icd9Field
The column in the data frame which contains the ICD-9 codes. This is a character vector of length one.
isShort
single logical value which determines whether the ICD-9 code provided is in short (TRUE) or decimal (FALSE) form.
icd9Mapping
list (or name of a list if character vector of length one is given as argument) of the comorbidities with each top-level list item containing a vector of decimal ICD9 codes. This is in the form of a list, with the names of the items corresponding to the c
validateMapping
logical, whether to validate all the ICD-9 codes in the mapping list. Default is not to check. If validation fails, stop with an error. This is probably worth doing at least once for each mapping used, since there should never be an error in mapping.
isShortMapping
logical, whether the mapping is defined with short ICD-9 codes (TRUE, the default), or decimal if set to FALSE.
abbrevNames
single locical value that defaults to TRUE, in which case the ishorter human-readable names stored in e.g. ahrqComorbidNamesAbbrev are applied to the data frame column names.
applyHierarchy
single logical value that defaults to TRUE, in which case the hierarchy defined for the mapping is applied. E.g. in Elixhauser, you can't have uncomplicated and complicated diabetes both flagged.