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]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.