in order to be more magrittr friendly, and to help easily pull out rows with valid or invalid icd9 codes. Complements similar functions for simple vectors of icd9 codes.
# get rows with invalid icd9 codes
myPatients %>% icd9FilterInvalid()
# same again, but convert to vector and find distinct invalid codes
myPatients %>% icd9FilterInvalid() %>% extract2("icd9") %>% unique
# show top few rows with valid codes, with named icd9 field:
myPatients %>% icd9FilterValid(icd9Field = "i9code", isShort = TRUE) %>% head
# get top few valid rows and show human readable names of the codes:
myPatients %>% icd9FilterValid() %>% extract2("icd9") %>% icd9Explain()
Validity vs existence in the master list of codes (which may be the wrong year, or incomplete..)
myPatients %>% icd9FilterExists()