van Walraven Elixhauser score is calculated from the Quan revision of
Elixhauser's ICD-9 mapping. This function allows for the hierarchical
exclusion of less severe versions of comorbidities when their more severe
version is also present via the hierarchy
argument. For the Elixhauser
comorbidities, this is diabetes v. complex diabetes and solid tumor v.
metastatic tumor
van_walraven(x, visit_name = NULL, return_df = FALSE,
stringsAsFactors = getOption("stringsAsFactors"), ...)# S3 method for data.frame
van_walraven(x, visit_name = NULL, return_df = FALSE,
stringsAsFactors = getOption("stringsAsFactors"), ...)
van_walraven_from_comorbid(x, visit_name = NULL, hierarchy = FALSE)
icd_van_walraven.data.frame(...)
icd_van_walraven(...)
icd_van_walraven_from_comorbid(...)
data frame containing a column of visit or patient identifiers, and
a column of ICD-9 codes. It may have other columns which will be ignored.
By default, the first column is the patient identifier and is not counted.
If visit_name
is not specified, the first column is used.
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, if true, a two column data frame will
be returned, with the first column named as in input data frame (i.e.
visit_name
), containing all the visits, and the second column
containing the Charlson Comorbidity Index.
Single logical value, describing whether the resulting data frame should have strings, e.g.
visit_id
converted to factor. Default is to follow the current session option. This is identical to the
argument used in, among other base functions as.data.frame
.
arguments passed on to other functions
single logical value that defaults to TRUE
, in
which case the hierarchy defined for the mapping is applied. E.g. in
Elixhauser, you can't have uncomplicated and complicated diabetes both
flagged.
data.frame
: van Walraven scores from data frame of visits
and ICD-9 codes
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 namespace prefix icd::
instead, e.g.,
icd::charlson
. Functions which specifically operate on either ICD-9
or ICD-10 codes or their subtypes will retain the prefix. E.g.
icd9_comorbid_ahrq
. icd specific classes also retain
the prefix, e.g., icd_wide_data
.
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 namespace prefix icd::
instead, e.g.,
icd::charlson
. Functions which specifically operate on either ICD-9
or ICD-10 codes or their subtypes will retain the prefix. E.g.
icd9_comorbid_ahrq
. icd specific classes also retain
the prefix, e.g., icd_wide_data
.
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 namespace prefix icd::
instead, e.g.,
icd::charlson
. Functions which specifically operate on either ICD-9
or ICD-10 codes or their subtypes will retain the prefix. E.g.
icd9_comorbid_ahrq
. icd specific classes also retain
the prefix, e.g., icd_wide_data
.
van Walraven C, Austin PC, Jennings A, Quan H, Forster AJ. A Modification to the Elixhauser Comorbidity Measures Into a Point System for Hospital Death Using Administrative Data. Med Care. 2009; 47(6):626-633. http://www.ncbi.nlm.nih.gov/pubmed/19433995
# NOT RUN {
mydf <- data.frame(visit_name = c("a", "b", "c"),
icd9 = c("412.93", "441", "042"))
van_walraven(mydf)
# or calculate comorbodities first:
cmb <- icd9_comorbid_quan_elix(mydf, short_code = FALSE, hierarchy = TRUE)
vwr <- van_walraven_from_comorbid(cmb)
stopifnot(identical(van_walraven(mydf), vwr))
# alternatively return as data frame in 'tidy' format
van_walraven(mydf, return_df = TRUE)
# }
Run the code above in your browser using DataLab