Medical Risk and Comorbidity Tools for ICD-9-CM Data

Generates risk estimates and comorbidity flags from ICD-9-CM codes available in administrative medical datasets. The package supports the Charlson Comorbidity Index, the Elixhauser Comorbidity classification, the Revised Cardiac Risk Index, and the Risk Stratification Index. Methods are table-based, fast, and use the 'plyr' package, so parallelization is possible for large jobs. Also includes a sample of real ICD-9 data for 100 patients from a publicly available dataset.


medicalrisk is a collection of tools and data for performing patient-level medical risk adjustment using administrative data.

The data sets include icd9cm_charlson and icd9cm_elixhauser, which are data frames that map ICD-9-CM codes to comorbidities, using the Charlson and Elixhauser classifications respectively. The mapping comes from the paper by Quan in 2005, and uses the CMS ICD-9-CM table.
With a properly formatted source data frame of patients and ICD-9-CM values, the cast or dcast methods can be used to generate comorbidity tables.

The add_charlson_index_df method will calculate the Charlson Comorbidity Index for each patient.

For data sources that present ICD-9-CM codes as a comma-separated listing, the melt_icd9list method will convert such data tables into a one-row-per-code format suitable for join or merge to the icd9cm_* tables.

Data Sources

For implementation, testing, and examples several external data sources are used:


medicalrisk v1.2 (release date 2016-01-23)

  • changed external data code to pull datafiles from source instead of including them in tarball
  • changes to accommodate github release
  • added "advanced" vignette

medicalrisk v1.1 (release date 2015-01-06)

  • first CRAN release
  • fixed various small issues to pass CRAN testing

medicalrisk v1.0 (internal release)

  • Initial release

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.3 by Patrick McCormick, a year ago

Report a bug at

Browse source code at

Authors: Patrick McCormick [aut, cre] , Thomas Joseph [aut]

Documentation:   PDF Manual  

GPL-3 | file LICENSE license

Imports plyr, reshape2, hash

Suggests testthat, knitr, ggplot2, gridExtra

See at CRAN