Take a 2D contingency table and create a data frame representing the individual cases.
Examples
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)
#> health_status
#> coverage Excellent Fair Good Poor Very good
#> No 459 385 854 99 727
#> Yes 4198 1634 4821 578 6245