R/checks.R
is_valid_icd.Rd
Check if string is valid ICD-10-CM code
is_valid_icd(x, arg = rlang::caller_arg(x), call = rlang::caller_env())
<chr> string of length(x) == 1
<chr>
length(x) == 1
<chr> function argument name in the current function
<env> environment the function is called from
<env>
<lgl> vector; TRUE if valid, FALSE otherwise
<lgl>
TRUE
FALSE
purrr::map_vec( c("H00.019", "D50.1", "C4A.70", "Z20.818", "11646", "E8015"), is_valid_icd) #> [1] "H00.019" "D50.1" "C4A.70" "Z20.818" "11646" "E8015"