table2d_summary.RdPrints a 2-way contingency table along with percentages, marginal, and conditional distributions.
table2d_summary(object, margins = TRUE, percentages = FALSE,
conditionals = c("none", "row", "column"), chisq.test = TRUE, ...)a \(r \times c\)-contingency table
if TRUE, marginal distributions are computed.
if TRUE, relative frequencies are computed.
if not "none", the conditional
distributions, given the row/column factor, are computed.
if TRUE, a chi-squared test of independence
is carried out.
currently not used.
Returns invisibly a \(r \times c \times k\) table, \(k\) depending on the amount of choices (at most 3).
data("UCBAdmissions")
table2d_summary(margin.table(UCBAdmissions, 1:2))
#> Gender
#> Admit Male Female TOTAL
#> Admitted 1198 557 1755
#> Rejected 1493 1278 2771
#> TOTAL 2691 1835 4526
#>
#> Number of cases in table: 4526
#> Number of factors: 2
#> Test for independence of all factors:
#> Chisq = 92.21, df = 1, p-value = 7.814e-22