Description Usage Arguments Examples
convert matrix of comorbidities into data frame, preserving visitId information
1 2 | icd9ComorbidMatToDf(x, visitId = "visitId",
stringsAsFactors = getOption("stringsAsFactors"))
|
x |
Matrix of comorbidities, with row and columns names defined |
visitId |
Single character string with name for new column in output
data frame. Everywhere else, |
stringsAsFactors |
whether the resulting data frame should have strings, i.e. visitId converted to factor. Default is to follow the current session option. |
1 2 3 4 5 6 7 8 9 10 11 | longdf <- data.frame(visitId = c("a", "b", "b", "c"),
icd9 = c("441", "4424", "443", "441"))
mat <- icd9ComorbidElix(longdf)
class(mat)
typeof(mat)
rownames(mat)
df.out <- icd9ComorbidMatToDf(mat)
stopifnot(is.data.frame(df.out))
# output data frame has a factor for the visitId column
stopifnot(identical(rownames(mat), as.character(df.out$visitId)))
df.out[, 1:4]
|
The icd9 package is now deprecated. The new 'icd' package is on CRAN and has ICD-10 support and bug-fixes. All the functions available in 'icd9' have been preserved in 'icd', but a simpler set of function names is also available.
To install it, use:
install.packages("icd")
# or for the development version:
devtools::install_github("jackwasey/icd")
Then:
remove.packages("icd9")
[1] "matrix"
[1] "logical"
[1] "a" "b" "c"
visitId CHF Arrhythmia Valvular
a a FALSE FALSE FALSE
b b FALSE FALSE FALSE
c c FALSE FALSE FALSE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.