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.
|
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)#> [1] "data.frame"rownames(cmbdf)#> [1] "1" "2" "3"#> CHF Arrhythmia Valvular PHTN #> a FALSE FALSE FALSE FALSE #> b FALSE FALSE TRUE FALSE #> c FALSE FALSE FALSE FALSE