# NOT RUN {
library(magrittr, warn.conflicts = FALSE, quietly = TRUE)
myData <- data.frame(
visit_id = c("v1", "v2", "v3", "v4"),
diag = c("39891", "39790", "41791", "4401"),
poa = c("Y", "N", NA, "Y"),
stringsAsFactors = FALSE
)
myData %>% icd_filter_poa_not_no() %>% icd_comorbid_ahrq()
# can fill out named fields also:
myData %>% icd_filter_poa_yes(poa_name="poa") %>%
icd_comorbid_ahrq(icd_name = "diag", visit_name = "visit_id", short_code = TRUE)
# can call the core icd_comorbid() function with an arbitrary mapping
myData %>%
icd_filter_poa_yes %>%
icd_comorbid(icd_name = "diag", visit_name = "visit_id",
map = icd_map_quan_elix, short_mapping = TRUE)
# }
Run the code above in your browser using DataLab