knitr::opts_chunk$set( collapse = TRUE, comment = "#>", out.width = "100%", fig.width = 14, fig.height = 10.5 # global.par = TRUE ) library("icd") n <- 10000 set.seed(1441) # load the dice with more PCCC diagnostic codes h <- c( icd10cm2019$code, rep(unlist(unname(icd10_map_pccc_dx)), 10) ) dat <- data.frame( id = n + seq(n), icd_dx1 = sample(h, n, replace = TRUE), icd_dx2 = sample(h, n, replace = TRUE) ) # for builds without the ability to download or use cached data, ignore pcs if (icd:::.exists_in_cache("icd10cm2019_pc")) { i <- get_icd10cm2019_pc()$code dat <- cbind(dat, icd_pcs1 = sample(i, n, replace = TRUE), icd_pcs2 = sample(i, n, replace = TRUE) ) }
The adult comorbidities defined by authors such as Charlson, Quan and Elixhuaser are not suitable for pediatric research. Feudtner and others produced comorbidity definitions suitable for infants and children, with mappings defined for both ICD-9 and ICD-10 codes [@Feinstein_packagepediatriccomplex_2018; @Feudtner_Pediatriccomplexchronic_2014]. These are now included in the icd package for R, which enables fast calculation of comorbidities for PCCC and other ICD code to comorbidity maps.
The PCCC comorbidities may be derived from both diagnostic and procedure codes. The following simulated data has both:
head(dat)
The data is in 'wide' format. icd
no longer needs the data to be in 'long' format. The PCCC comorbidity classes can be computed directly from the source data and summarized in a plot. Here we calculate the PCCC from ICD diagnostic codes and ICD procedure codes separately, and logically combine them to get the result.
pccc_dx <- comorbid_pccc_dx(dat) if (icd:::.exists_in_cache("icd10cm2019_pc")) { pccc_pcs <- icd10_comorbid_pccc_pcs(dat, icd_name = c("icd_pcs1", "icd_pcs2") ) res <- pccc_dx | pccc_pcs } else { res <- pccc_dx }
pccc_dx <- comorbid_pccc_dx(dat) pccc_pcs <- icd10_comorbid_pccc_pcs(dat, icd_name = c("icd_pcs1", "icd_pcs2") ) res <- pccc_dx | pccc_pcs
res[295:300, ]
Let's look at the summary results:
colSums(res)
#graphics::par(mar = c(12, 4, 4, 2) + 0.1) # bottom, left, top, right
graphics::barplot(sort(colSums(res), decreasing = TRUE), names.arg = names_pccc, ylab = "count", las = 2, cex.names = 0.75 )
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.