Learn R Programming

icd (version 3.3)

get_icd_name: get the name of a data.frame column which is most likely to contain the ICD codes

Description

guess which field contains the (only) ICD code, in order of preference, the column name has an icd code class, case-insensitive regular expressions of commonly used names for ICD code fields, a single column has more than 10 valid ICD codes. If the result is not specified by class, or exactly with icd_name being given, we confirm there are at least some valid ICD codes in there

Usage

get_icd_name(x, icd_name = NULL, valid_codes = TRUE,
  defined_codes = FALSE)

Arguments

x

data frame

icd_name

usually NULL but if specified, will be checked it is valid (i.e. a character vector of length one, which is indeed a name of one of x's columns) and returned unchanged