The guess is indeed a guess and can be wrong. There are some codes which could be either ICD-9 or ICD-10. The current implementation doesn't check whether the codes exist in any definitions (ICD-9 CM or WHO, for example), just whether they are valid.
icd_guess_version(x, short_code, ...)# S3 method for icd9
icd_guess_version(x, short_code, ...)
# S3 method for icd10
icd_guess_version(x, short_code, ...)
# S3 method for factor
icd_guess_version(x, short_code = NULL, ...)
# S3 method for character
icd_guess_version(x, short_code = NULL, n = 10, ...)
# S3 method for data.frame
icd_guess_version(x, short_code = NULL,
icd_name = get_icd_name(x), ...)
input data
single logical value which determines whether the ICD-9
code provided is in short (TRUE
) or decimal (FALSE
) form.
Where reasonable, this is guessed from the input data.
number of elements or rows to sample
The name of the column in the data.frame
which
contains the ICD codes. This is a character vector of length one. If it is
NULL
, icd9
will attempt to guess the column name, looking for
progressively less likely possibilities until it matches a single column.
Failing this, it will take the first column in the data frame. Specifying
the column using this argument avoids the guesswork.
icd9
: Guess version class ICD-9 codes
icd10
: Guess version of class ICD-10 codes
factor
: Guess version of ICD codes in a factor
character
: Guess version of ICD codes in character vector
data.frame
: Guess version of ICD codes in a field in a
data.frame
Currently, ambiguous codes are guessed true or false, with no indication of uncertainty. Possible solutions are adding an attribute, warning, or optionally throwing an error.