## over two tables
r <- LETTERS[1:2]
y <- cm3(row_tot = c(18, 20) * 2, col_tot = c(16, 22) * 2,
m = array(c(5, 1, 2, 7, 4, 2, 5, 9), dim = c(2, 2, 2),
dimnames = list(orig = r, dest = r, type = c("ILL", "HEALTHY"))))
# display with row, col and table totals
y
## over three tables
y <- cm3(row_tot = c(170, 120, 410), col_tot = c(500, 140, 60),
m = array(c(5, 1, 2, 7, 4, 2, 5, 9, 5, 4, 3, 1), dim = c(2, 2, 3),
dimnames = list(orig = r, dest = r, type = c("0--15", "15-60", ">60"))),
verbose = FALSE)
# display with row, col and table totals
y
Run the code above in your browser using DataLab