# prepare sample data set
library(sjmisc)
data(efc)
efc.labels <- get_labels(efc)
# print simple cross table with labels
sjt.xtab(efc$e16sex, efc$e42dep)
# print cross table with manually set
# labels and expected values
sjt.xtab(efc$e16sex,
efc$e42dep,
variableLabels = c("Elder's gender",
"Elder's dependency"),
valueLabels = list(efc.labels[['e16sex']],
efc.labels[['e42dep']]),
showExpected = TRUE)
# print minimal cross table with labels, total col/row highlighted
sjt.xtab(efc$e16sex, efc$e42dep,
showHorizontalLine = FALSE,
showCellPerc = FALSE,
highlightTotal = TRUE)
# ----------------------------------------------------------------
# User defined style sheet
# ----------------------------------------------------------------
sjt.xtab(efc$e16sex, efc$e42dep,
CSS = list(css.table = "border: 2px solid;",
css.tdata = "border: 1px solid;",
css.horline = "border-bottom: double blue;"))Run the code above in your browser using DataLab