mydf <- data.frame(visitId = c("r", "r", "s"),
icd9 = c("441", "412.93", "044.9"))
icd9Count(mydf, return.df = TRUE)
icd9Count(mydf)
cmb <- icd9ComorbidQuanDeyo(mydf, isShort = FALSE, return.df = TRUE)
icd9CountComorbidBin(cmb)
wide <- data.frame(visitId = c("r", "s", "t"),
icd9_1 = c("0011", "441", "456"),
icd9_2 = c(NA, "442", NA),
icd9_3 = c(NA, NA, "510"))
icd9CountWide(wide)
# or:
library(magrittr)
wide %>% icd9WideToLong %>% icd9Count
Run the code above in your browser using DataLab