An ICD code consists of, at a minimum, a three digit ICD-10 code (i.e. one upper-case letter followed by two digits). This may optionally be followed by a two digit subcode, selected punctuation symbols (cross "*", dagger "U2020" or exclamation mark "!"). Both the period separating the three-digit code from the subcode, and the hyphen indicating an "incomplete" subcode, are optional. Finally, in the ambulatory system, an additional letter G, V, Z or A may be appended to signify the status ("security") of the diagnosis.
is_icd_code(str, year = NULL, parse = TRUE)
str | Character vector to be tested |
---|---|
year | Year for which to test whether the specification is a valid code. Default: NULL (test whether |
parse | logical. Whether to first parse the input |
Logical vector the same length as the character input
is_icd_code("A09.9")#> [1] TRUEis_icd_code("A099")#> [1] TRUEis_icd_code("A09.9-")#> [1] TRUEis_icd_code("AA9")#> [1] FALSE# The following code is syntactically correct but # has never been in use is_icd_code("E15.9")#> [1] FALSE