Package overview

icd-package

icd: Comorbidity Calculations and Tools for ICD-9 and ICD-10 Codes

Comorbidity and risk score calculations

comorbid() icd10_comorbid() icd9_comorbid() icd9_comorbid_ahrq() icd10_comorbid_ahrq() icd9_comorbid_elix() icd10_comorbid_elix() icd9_comorbid_quan_elix() icd10_comorbid_quan_elix() icd9_comorbid_quan_deyo() icd10_comorbid_quan_deyo() icd9_comorbid_charlson() icd10_comorbid_charlson() comorbid_ccs() icd9_comorbid_ccs() icd10_comorbid_ccs() comorbid_ahrq() comorbid_elix() comorbid_quan_elix() comorbid_quan_deyo() comorbid_charlson()

Find comorbidities from ICD-9 codes.

comorbid_hcc() icd9_comorbid_hcc() icd10_comorbid_hcc()

Get Hierarchical Condition Codes (HCC)

comorbid_pccc_dx() comorbid_pccc_pcs() icd9_comorbid_pccc_dx() icd10_comorbid_pccc_dx() icd9_comorbid_pccc_pcs() icd10_comorbid_pccc_pcs()

Calculate pediatric complex chronic conditions (PCCC) comorbidities

charlson()

Calculate Charlson Comorbidity Index (Charlson Score)

charlson_from_comorbid()

Calculate Charlson scores from precomputed Charlson comorbidities

van_walraven() van_walraven_from_comorbid()

Calculate van Walraven Elixhauser Score

count_codes()

Count ICD codes or comorbidities for each patient

count_codes_wide()

Count ICD codes given in wide format

count_comorbid()

Count number of comorbidities per patient

Comorbidity to ICD code maps

icd9_map_ahrq

AHRQ comorbidities

icd9_map_elix

Elixhauser comorbidities

icd9_map_hcc

Medicare Hierarchical Condition Categories

icd9_map_pccc

Pediatric Complex Chronic Conditions

icd9_map_quan_deyo

Quan adaptation of Deyo/Charlson comorbidities

icd9_map_quan_elix

Quan adaptation of Elixhauser comorbidities

icd9_map_single_ccs

Clinical Classifications Software (CCS) for ICD9/10-CM

icd10_map_ahrq_pcs

AHRQ ICD-10-PCS categories

names_elix

Comorbidity names

Transforming data

Reshaping of typical healthcare data frames containing one or more ICD code columns. Convert comorbidity results between matrices and ‘tidy’ data frmes.

comorbid_df_to_mat()

convert comorbidity matrix to data frame

comorbid_mat_to_df()

convert comorbidity data frame from matrix

long_to_wide()

Convert ICD data from long to wide format

wide_to_long()

Convert ICD data from wide to long format

convert

Convert ICD data between formats and structures.

Metadata

Optionally describe and check the type and structure of your data. This enables functions like ‘is_valid’ and ‘explain_code’ to look up codes in the appropriate version of ICD-9 or ICD-10.

as.icd9() as.icd9cm() as.icd9cm_pc() as.icd10() as.icd10cm() as.icd10cm_pc() as.icd10who() as.icd10fr() as.icd10be()

Construct ICD-9 and ICD-10 data types

as.icd_long_data() as.icd_wide_data() icd_long_data() icd_wide_data()

Set the ICD data structure class of a matrix or data.frame.

as.decimal_diag() as.icd_decimal_diag() as.short_diag() as.icd_short_diag() is.decimal_diag() is.icd_decimal_diag() is.short_diag() is.icd_short_diag()

Get or set whether ICD codes have have an attribute indicating 'short' or 'decimal' format

as.comorbidity_map()

Set the class of a named list to show it is a comorbidity map.

is.icd9() is.icd9cm() is.icd9cm_pc() is.icd9who() is.icd10() is.icd10cm() is.icd10cm_pc() is.icd10who() is.icd10fr() is.icd10be() is.comorbidity_map()

Test presence of ICD classes

is.icd_long_data() is.icd_wide_data()

Test for class describing patient data

icd9_chapters

ICD-9 chapters

icd9_sub_chapters

ICD-9 sub-chapters

icd10_chapters

ICD-10 chapters

icd10_sub_chapters

ICD-10 sub-chapters

is_billable()

Check whether a code is billable according to ICD-9-CM or ICD-10-CM

get_billable()

Get the subset of codes that are billable according to ICD-9-CM or ICD-10-CM

Manipulation

Working with codes and the ICD hierarchies

children()

Get children of ICD codes

condense() icd9_condense_decimal()

Condense ICD-9 code by replacing complete families with parent codes

c(<icd9>) c(<icd10>)

Combine ICD codes

diff_comorbid()

show the difference between two comorbidity mappings

filter_poa() filter_poa_yes() filter_poa_no() filter_poa_not_no() filter_poa_not_yes()

Filters data frame based on present-on-arrival flag

filter_valid() filter_invalid() icd9_filter_valid() icd10_filter_valid() icd9_filter_invalid() icd10_filter_invalid()

Filter ICD codes by validity.

get_defined()

Select only defined ICD codes

`[`(<icd9>) `[[`(<icd9>) `[`(<icd10>) `[[`(<icd10>)

extract subset(s) from ICD data

icd9_map_ahrq

AHRQ comorbidities

International and historic ICD editions

set_icd_data_dir() get_icd_data_dir()

Set up the data download cache, give permission to download data

download_all_icd_data()

Download all the additional data at once

set_icd10cm_active_year() get_icd10cm_active_year()

Get or set the annual version of ICD-10-CM to use

get_icd10cm_version() get_icd10cm_active()

Get the data for a given version (four-digit year) of ICD-10-CM

get_icd10cm_available()

Get the ICD-10-CM versions available in this package

get_icd10cm_latest() get_icd10cm_latest()

The latest available version of ICD-10-CM in this package

ICD data included in the package

icd9cm2014_leaf

The final ICD-9-CM list of leaf (‘billable’) codes

icd10cm2019

United States and Belgium ICD-10-CM

vermont_dx

Hospital discharge data from Vermont

uranium_pathology

United States Transuranium & Uranium Registries

Get ICD data

This is needed for explaining codes, and checking validity. The package includes data for the most recent ICD-9-CM and ICD-10-CM. Some editions, like WHO, cannot be distributed in the package due to copyright. Others are also available for download on demand, or in bulk using download_all_icd_data().

with_icd10cm_version()

Evaluate code with a particular version of ICD-10-CM

get_icd10be2014

Belgian ICD-10-BE

get_icd10be2014_pc

ICD-10-BE 2014 procedure codes

get_icd10be2017

ICD-10-BE 2017

get_icd10be2017_pc

ICD-10-BE 2017 procedure codes

get_icd10cm2014

ICD-10-CM 2014

get_icd10cm2014_pc

ICD-10-CM Procedure codes for 2014

get_icd10cm2015

ICD-10-CM 2015

get_icd10cm2015_pc

ICD-10-CM Procedure codes for 2015

get_icd10cm2016

ICD-10-CM 2016

get_icd10cm2016_pc

ICD-10-CM Procedure codes for 2016

get_icd10cm2017

ICD-10-CM 2017

get_icd10cm2017_pc

ICD-10-CM Procedure codes for 2017

get_icd10cm2018

ICD-10-CM 2018

get_icd10cm2018_pc

ICD-10-CM Procedure codes for 2018

get_icd10cm2019

ICD-10-CM 2019

get_icd10cm2019_pc

ICD-10-CM Procedure Codes

get_icd10fr2019

French ICD-10-FR modification of WHO ICD-10 used in France

get_cim10fr2019()

Localised synonym for get_icd10fr2019, with French column names

get_icd10who2008fr

2008 WHO ICD-10 data in French

get_icd10who2016

2016 WHO ICD-10 data

icd9cm_hierarchy

ICD-9-CM diagnosis codes including leaf nodes and branch names up to the three-digit codes.

get_icd9cm2014_leaf

ICD-9-CM, just billable/leaf codes

Other

sort_icd() sort(<icd10>) sort(<icd10cm>) sort(<icd10be>) sort(<icd9>) order.icd9() order.icd10cm() order.icd10be()

Sort or order ICD-9 or ICD-10 codes according to published sequence

plot_comorbid() plot_comorbid_results()

Basic ordered bar plot showing counts of each comorbidity

poa_choices

Present-on-admission flags

print(<icd9>) print(<icd10>)

Print ICD codes and comorbidity maps cleanly