Calculate Charlson scores from precomputed Charlson comorbidities, instead of directly from the ICD codes. This is useful if the comorbidity calculation is time consuming. Commonly, both the Charlson comorbidities and the Charlson scores will be calculated, and this function provides just that second step.
charlson_from_comorbid(x, visit_name = NULL, hierarchy = FALSE,
scoring_system = c("original", "charlson", "quan"))icd_charlson_from_comorbid(...)
data.frame or matrix, typically the output of a comorbidity
calculation which uses the Charlson categories, e.g.
comorbid_quan_deyo
The name of the column in the data frame which contains the
patient or visit identifier. Typically this is the visit identifier, since
patients come leave and enter hospital with different ICD-9 codes. It is a
character vector of length one. If left empty, or NULL
, then an
attempt is made to guess which field has the ID for the patient encounter
(not a patient ID, although this can of course be specified directly). The
guesses proceed until a single match is made. Data frames may be wide with
many matching fields, so to avoid false positives, anything but a single
match is rejected. If there are no successful guesses, and visit_id
was not specified, then the first column of the data frame is used.
single logical value, default is FALSE
. If
TRUE
, will drop DM
if DMcx
is present, etc.
One of original
, charlson
, or
quan
. The first two will give the original Charlson weights for each
comorbidity, whereas quan
uses the updated weights from Quan 2011.
arguments passed on to other functions
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
.