is_icd_code {ICD10gm} | R Documentation |
Test whether a string is a valid ICD code
Description
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.
Usage
is_icd_code(str, year = NULL, parse = TRUE)
Arguments
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 |
Value
Logical vector the same length as the character input
See Also
Examples
is_icd_code("A09.9")
is_icd_code("A099")
is_icd_code("A09.9-")
is_icd_code("AA9")
# The following code is syntactically correct but
# has never been in use
is_icd_code("E15.9")