Open andrewallenbruce opened 6 months ago
library(purrr) library(pathologie) x <- c("H00.019", "D50.1", "C4A.70", "Z20.818", "11646", "E8015") purrr::map_vec(x, is_valid_icd) [1] "H00.019" "D50.1" "C4A.70" "Z20.818" "11646" "E8015"
Created on 2024-04-01 with reprex v2.1.0
if (nchar(x) < 3 | nchar(x) > 8) FALSE
if (nchar(x) == 3) { ...rules for valid alphanumeric combos... }
if (nchar(x) >= 4) {strsub(x, 4, 4) == "."}
stringr regex tutorial
Created on 2024-04-01 with reprex v2.1.0