# NOT RUN {
# prepare sample data set
data(efc)
# print simple cross table with labels
# }
# NOT RUN {
tab_xtab(efc$e16sex, efc$e42dep)
# print cross table with manually set
# labels and expected values
tab_xtab(
efc$e16sex,
efc$e42dep,
var.labels = c("Elder's gender", "Elder's dependency"),
show.exp = TRUE
)
# print minimal cross table with labels, total col/row highlighted
tab_xtab(efc$e16sex, efc$e42dep, show.cell.prc = FALSE, emph.total = TRUE)
# User defined style sheet
tab_xtab(efc$e16sex, efc$e42dep,
CSS = list(css.table = "border: 2px solid;",
css.tdata = "border: 1px solid;",
css.horline = "border-bottom: double blue;"))
# }
# NOT RUN {
# ordinal data, use Kendall's tau
tab_xtab(efc$e42dep, efc$quol_5, statistics = "kendall")
# calculate Spearman's rho, with continuity correction
tab_xtab(
efc$e42dep,
efc$quol_5,
statistics = "spearman",
exact = FALSE,
continuity = TRUE
)
# }
Run the code above in your browser using DataLab