comorb: Convert diagnosis codes to AHRQ comorbidities

View source: R/comorb.R

comorbR Documentation

Convert diagnosis codes to AHRQ comorbidities

Description

Convert ICD-10 diagnosis codes to a table of indicators for each of the 39 comorbidities using the 2021.1 definitions of the comorbidities.

Usage

comorb(
  tbl,
  diagcol = "diagnosis",
  poacol = "poa",
  idcol = "id",
  dotless = FALSE
)

Arguments

tbl

Table of input data

diagcol

Column containing the diagnosis codes. Default is 'diagnosis'.

poacol

Column containing the present-on-admission flags. Default is 'poa'.

idcol

Column containing the id variable (see details). Default is 'id'. Passing NULL will treat the entire table as a single case.

dotless

If TRUE, assume the diagnosis codes are already in dotless format. Otherwise, the codes will be converted to dotless. Setting this flag can save a little time if you are certain your codes are already dotless.

Details

The input table should have columns for diagnosis code and POA flag. Optionally there can be an ID column, the value of which indicates which diagnoses belong to the same aggregation unit (e.g., claim, or patient). If the ID column is omitted, the entire table is assumed to belong to a single aggregation unit, as might be the case if, for example, a larger table were split on an ID column before being passed in.

The return value will be a table that includes the ID column, if any, and columns for the 39 comorbidities, with a 1 indicating that the comorbidity is present, and a 0 indicating that it is absent. The clinically similar conditions are accounted for, so if multiple levels of severity are indicated by the diagnosis codes, only the most severe will be recorded.

Note that we leave the two subcategories of cerebrovascular disease (CBVD and CBVD_SQLA) separate because they are separated in the reference table supplied by AHRQ.


rplzzz/AHRQcomorb documentation built on Aug. 10, 2024, 8:12 a.m.