Learn R Programming

icd (version 2.2)

icd_is_defined: Check whether ICD-9 codes exist

Description

This is different from syntactic validity: it looks it up in the canonical list of ICD-9 codes published by the CMS, and which are included in this package under data-raw. Checking syntactic validity using link{icd_is_valid} etc. is still useful, with a changing list of ICD-9 codes over time, and possible imperfections in the master lists derived from CMS.

Usage

icd_is_defined(x, short_code = icd_guess_short(x), ...)

# S3 method for icd9 icd_is_defined(x, short_code = icd_guess_short(x), billable = FALSE, ...)

# S3 method for icd10cm icd_is_defined(x, short_code = icd_guess_short(x), billable = FALSE, nomatch = 0L, ...)

# S3 method for icd10 icd_is_defined(x, short_code = icd_guess_short(x), billable = FALSE, ...)

# S3 method for default icd_is_defined(x, short_code = icd_guess_short(x), ...)

Arguments

x

vector if ICD codes to test whether defined in certain ICD code list

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.

...

arguments passed on to other functions

billable

single logical value, whether to limit return codes also by whether they are billable, i.e. leaf nodes. This is really only designed for use with ICD-9-CM, ICD-10-CM etc, since the WHO versions are not designed for billing, but for public health and death reporting.

nomatch

integer value, passed to match default is 0. Setting this to NA_integer_ would stop NA values being treated as undefined.

Value

logical vector

Methods (by class)

  • icd9: Check whether ICD-9 code are defined. (ICD-9-CM by default)

  • icd10cm: Same for ICD-10-CM

  • icd10: Same for ICD-10, temporarily using ICD-10-CM until ICD-10 WHO is available in this package

  • default: default method which will guess the ICD version (9 vs 10, maybe WHO vs CM or other in the future) and dispatches again on that type.