Learn R Programming

icd (version 3.0.0)

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{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

is_defined(x, short_code = guess_short(x), ...)

# S3 method for icd9 is_defined(x, short_code = guess_short(x), billable = FALSE, ...)

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

# S3 method for icd10 is_defined(x, short_code = guess_short(x), billable = FALSE, ...)

# S3 method for default is_defined(x, short_code = guess_short(x), ...)

icd_is_defined.default(...)

icd_is_defined.icd10(...)

icd_is_defined.icd10cm(...)

icd_is_defined.icd9(...)

icd_is_defined(...)

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.

...

arguments passed on to other functions

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.

Deprecated function names

Future versions of icd will drop the icd_ prefix. For example, charlson should be used in favor of icd_charlson. To distinguish icd function calls, consider using the namespace prefix icd:: instead, e.g., icd::charlson. Functions which specifically operate on either ICD-9 or ICD-10 codes or their subtypes will retain the prefix. E.g. icd9_comorbid_ahrq. icd specific classes also retain the prefix, e.g., icd_wide_data.

Future versions of icd will drop the icd_ prefix. For example, charlson should be used in favor of icd_charlson. To distinguish icd function calls, consider using the namespace prefix icd:: instead, e.g., icd::charlson. Functions which specifically operate on either ICD-9 or ICD-10 codes or their subtypes will retain the prefix. E.g. icd9_comorbid_ahrq. icd specific classes also retain the prefix, e.g., icd_wide_data.

Future versions of icd will drop the icd_ prefix. For example, charlson should be used in favor of icd_charlson. To distinguish icd function calls, consider using the namespace prefix icd:: instead, e.g., icd::charlson. Functions which specifically operate on either ICD-9 or ICD-10 codes or their subtypes will retain the prefix. E.g. icd9_comorbid_ahrq. icd specific classes also retain the prefix, e.g., icd_wide_data.

Future versions of icd will drop the icd_ prefix. For example, charlson should be used in favor of icd_charlson. To distinguish icd function calls, consider using the namespace prefix icd:: instead, e.g., icd::charlson. Functions which specifically operate on either ICD-9 or ICD-10 codes or their subtypes will retain the prefix. E.g. icd9_comorbid_ahrq. icd specific classes also retain the prefix, e.g., icd_wide_data.

Future versions of icd will drop the icd_ prefix. For example, charlson should be used in favor of icd_charlson. To distinguish icd function calls, consider using the namespace prefix icd:: instead, e.g., icd::charlson. Functions which specifically operate on either ICD-9 or ICD-10 codes or their subtypes will retain the prefix. E.g. icd9_comorbid_ahrq. icd specific classes also retain the prefix, e.g., icd_wide_data.