Learn R Programming

icd (version 3.3)

guess_version: Guess version of ICD codes

Description

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.

Usage

guess_version(x, short_code, ...)

# S3 method for factor guess_version(x, short_code = NULL, ...)

# S3 method for character guess_version(x, short_code = NULL, ...)

# S3 method for data.frame guess_version(x, short_code = NULL, icd_name = NULL, ...)

icd_guess_version.character(...)

icd_guess_version.data.frame(...)

icd_guess_version.factor(...)

icd_guess_version.icd10(...)

icd_guess_version.icd9(...)

icd_guess_version(...)

Arguments

x

input data

short_code

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.

icd_name

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.

n

number of elements or rows to sample

Methods (by class)

  • 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

Details

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.