The function icd_expand
takes a data.frame containing ICD codes
and optional metadata as input. It returns a data.frame containing
all ICD codes at or below the specified level of the hierarchy
(e.g. the specification "E11" is expanded to include all three,
four and five-digit codes beginning with E11).
icd_expand(icd_in, year, col_icd = "ICD", col_meta = NULL, type = "strict", ignore_icd_errors = FALSE)
icd_in | Data frame defining ICD codes of interest |
---|---|
year | ICD 10 version |
col_icd | Column of icd_in containing ICD codes (Default: ICD) |
col_meta | (Optional) Columns containing meta information to retain (e.g. Grouper, age or other criteria for later use). If left NULL, only col_icd is retained. |
type | A character string determining how strictly matching should be performed, passed to |
ignore_icd_errors | logical. Whether to ignore incorrectly specified input (potentially leading to incomplete output) or stop if any ICD specification does not correspond to a valid ICD code. Default: |
data.frame with columns YEAR, ICD_CODE, ICD_COMPRESSED, ICD_LABEL and, if specified, columns specified by col_meta