icd9Count takes a data frame with a column for
visitId and another for ICD-9 code, and returns the number of
distinct codes for each patient.
The visitId field is typically the first column. If there is no column
visitId is not specified, the first column
icd9CountComorbidBin differs from the other counting
functions in that it counts _comorbidities_, not individual diagnoses. It
accepts any data frame with either logicals or zero/non-zero contents, with
a single column for visitId. No checks are made to see whether visitId is
icd9Count, it is assumed that all the columns apart
visitId represent actual or possible ICD-9 codes. Duplicate
visitIds are repeated as given and aggregated.
1 2 3 4 5
data frame with one row per patient, and a true/false or 1/0 flag
for each column. By default, the first column is the patient identifier and
is not counted. If
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
single logical, if
single logical, default is FALSE. If TRUE, the length (or rows) of the output will no longer match the input, but duplicate visitIds will be counted together.
vector of the count of comorbidities for each patient. This is sometimes used as a metric of comorbidity load, instead of, or inaddition to metrics like the Charlson Comorbidity Index (aka Charlson Score)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
mydf <- data.frame(visitId = c("r", "r", "s"), icd9 = c("441", "412.93", "044.9")) icd9Count(mydf, return.df = TRUE) icd9Count(mydf) cmb <- icd9ComorbidQuanDeyo(mydf, isShort = FALSE, return.df = TRUE) icd9CountComorbidBin(cmb) wide <- data.frame(visitId = c("r", "s", "t"), icd9_1 = c("0011", "441", "456"), icd9_2 = c(NA, "442", NA), icd9_3 = c(NA, NA, "510")) icd9CountWide(wide) # or: library(magrittr) wide %>% icd9WideToLong %>% icd9Count
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.