comorbid_df_to_mat | R Documentation |
convert matrix of comorbidities into data frame, preserving visit_name information
comorbid_df_to_mat(
x,
visit_name = get_visit_name(x),
stringsAsFactors = getOption("stringsAsFactors")
)
x |
data frame, with a |
visit_name |
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 |
stringsAsFactors |
Single logical value, describing whether the resulting data frame should have strings, e.g.
|
comorbid_mat_to_df
Other ICD data conversion:
comorbid_mat_to_df()
,
convert
,
decimal_to_short()
,
long_to_wide()
,
short_to_decimal()
,
wide_to_long()
longdf <- icd_long_data(
visit = c("a", "b", "b", "c"),
icd9 = c("441", "4240", "443", "441")
)
cmbdf <- icd9_comorbid_elix(longdf, return_df = TRUE)
class(cmbdf)
rownames(cmbdf)
mat.out <- comorbid_df_to_mat(cmbdf)
stopifnot(is.matrix(mat.out))
mat.out[, 1:4]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.