str(esoph)
bCrosstab(with(esoph,list(agegp, alcgp))) $ ctab
grps <- with(esoph, list(age = agegp, alc = alcgp, tob = tobgp))
bCn <- bCrosstab( grps, reorder = FALSE)
stopifnot(all.equal(bCn$flist, grps))
str(bC <- bCrosstab(grps))
bC$ctab$"alc:age" # generally 4 obs. per cell, but not always:
aa.m <- as(bC$ctab$"alc:age", "matrix")
table(aa.m) # #(2,3,4) = (2, 4, 18)
stopifnot(all.equal(as.vector(t(aa.m)),
as.vector(table(with(esoph, alcgp:agegp))), tol=0))
Run the code above in your browser using DataLab