CrossTable(x, y, digits=3, max.width = 5, expected=FALSE, prop.r=TRUE, prop.c=TRUE,
prop.t=TRUE, prop.chisq=TRUE, chisq = FALSE, fisher=FALSE, mcnemar=FALSE,
resid=FALSE, sresid=FALSE, asresid=FALSE,
missing.include=FALSE,
format=c("SAS","SPSS"), dnn = NULL, ...)
TRUE
, chisq will be set to TRUE
and
expected cell counts from the $\chi^2$ will be
includedTRUE
, row proportions will be includedTRUE
, column proportions will be includedTRUE
, table proportions will be includedTRUE
, chi-square contribution of each cell will be includedTRUE
, the results of a chi-square test will
be includedTRUE
, the results of a Fisher Exact test will
be includedTRUE
, the results of a McNemar test will
be includedTRUE
, residual (Pearson) will be includedTRUE
, standardized residual will be includedTRUE
, adjusted standardized residual will be includedTRUE
, then remove any unused factor levelst: An n by m matrix containing table cell counts
prop.col: An n by m matrix containing cell column proportions
prop.row: An n by m matrix containing cell row proportions
prop.tbl: An n by m matrix containing cell table proportions
chisq: Results from the Chi-Square test. A list with class 'htest'. See ?chisq.test for details
chisq.corr: Results from the corrected Chi-Square test. A list with class 'htest'. See ?chisq.test for details. ONLY included in the case of a 2 x 2 table.
fisher.ts: Results from the two-sided Fisher Exact test. A list with class 'htest'. See ?fisher.test for details. ONLY included if 'fisher' = TRUE.
fisher.lt: Results from the Fisher Exact test with HA = "less". A list with class 'htest'. See ?fisher.test for details. ONLY included if 'fisher' = TRUE and in the case of a 2 x 2 table.
fisher.gt: Results from the Fisher Exact test with HA = "greater". A list with class 'htest'. See ?fisher.test for details. ONLY included if 'fisher' = TRUE and in the case of a 2 x 2 table.
mcnemar: Results from the McNemar test. A list with class 'htest'. See ?mcnemar.test for details. ONLY included if 'mcnemar' = TRUE.
mcnemar.corr: Results from the corrected McNemar test. A list with class 'htest'. See ?mcnemar.test for details. ONLY included if 'mcnemar' = TRUE and in the case of a 2 x 2 table.
resid/sresid/asresid: Pearson Residuals (from chi-square tests).
Note: If 'x' is a vector and 'y' is not specified, no statistical tests
will be performed, even if any are set to TRUE
.
xtabs
,
table
,
prop.table
# Simple cross tabulation of education versus prior induced abortions
# using infertility data
data(infert, package = "datasets")
CrossTable(infert$education, infert$induced, expected = TRUE)
CrossTable(infert$education, infert$induced, expected = TRUE, format="SAS")
CrossTable(infert$education, infert$induced, expected = TRUE, format="SPSS")
CrossTable(warpbreaks$wool, warpbreaks$tension, dnn = c("Wool", "Tension"))
Run the code above in your browser using DataLab