CT2DF | R Documentation |
Take a 2D contingency table and create a data frame representing the individual cases.
CT2DF(x, rn = row.names(x), cn = colnames(x), dfn = c("row.var", "col.var"))
x |
Contingency table as a matrix. |
rn |
Character vector of the row names. |
cn |
Character vector of the column names. |
dfn |
Character vector with 2 values for the variable representing the rows and columns. |
A data frame with two columns.
David Diez
MosaicPlot
a <- matrix(
c(459, 727, 854, 385, 99, 4198, 6245, 4821, 1634, 578),
2,
byrow = TRUE
)
b <-
CT2DF(
a,
c("No", "Yes"),
c("Excellent", "Very good", "Good", "Fair", "Poor"),
c("coverage", "health_status")
)
table(b)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.