Learn R Programming

icd (version 3.3)

filter_valid: Filter ICD codes by validity.

Description

Filters a data.frame of patients for valid or invalid ICD codes

Usage

filter_valid(x, icd_name = get_icd_name(x),
  short_code = guess_short(.subset2(x, icd_name)), invert = FALSE)

filter_invalid(x, icd_name = get_icd_name(x), short_code = guess_short(x[[icd_name]]), invert = FALSE)

icd9_filter_valid(x, icd_name = get_icd_name(x), short_code = guess_short(x[[icd_name]]), invert = FALSE)

icd10_filter_valid(x, icd_name = get_icd_name(x), short_code = guess_short(x[[icd_name]]), invert = FALSE)

icd9_filter_invalid(x, icd_name = get_icd_name(x), short_code = guess_short(x[[icd_name]]), invert = FALSE)

icd10_filter_invalid(x, icd_name = get_icd_name(x), short_code = guess_short(x[[icd_name]]), invert = FALSE)

icd_filter_invalid(...)

icd_filter_valid(...)

Arguments

x

a data.frame containing a column of ICD codes

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.

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.

invert

Single logical value. Returns the inverse of the result. E.g. if seeking valid ICD-9 codes, the invalid ones are returned.

...

arguments passed to the class-specific functions

Functions

  • filter_invalid: Filter invalid rows from data frame of patients with ICD codes. This can also be achieved with filter_valid and invert = TRUE

  • icd9_filter_valid: Filter data frame for valid ICD codes

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 prefix icd:: instead, e.g., icd::charlson. Functions which specifically operate on either ICD-9 or ICD-10 codes or their sub-types will retain the prefix. E.g. icd9_comorbid_ahrq. icd specific classes also retain the prefix, e.g., icd_wide_data.