Add the external cause flag (E) to appropriate ICD-9 UCOD codes
Source:R/prefix_e_to_ucod.R
prefix_e_to_ucod.RdAll UCOD ICD-9 codes between 800 and 999 are external cause of injury (E)
codes. Because this operates on the padded 4-character code (e.g. "8001"
for 800.1, as produced by pad_3char_codes(), which
clean_icd9_data() already runs before this), the numeric guard checks
8000-9999, the padded-code equivalent of the 800-999 range. We append the E
to them to make regexing across UCOD and record columns consistent.
Examples
prefix_e_to_ucod(c(7951, 8001, 9992, 6000, 4000))
#> [1] "7951" "E8001" "E9992" "6000" "4000"