CrossTable(x, y, digits = 3, max.width = NA, 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,
cell.layout = TRUE, xlab, ylab, ...)TRUE, row proportions will be included.TRUE, column proportions will be included.TRUE, table proportions will be included.TRUE, chisq will be set to TRUE and
expected cell counts from the $\chi^2$ will be included.
The value of expected will be set to TRUE if chisq,
resid, sresTRUE, chi-square contribution of each cell will be
included.TRUE, the results of a chi-square test will be
included. The value of chisq will be set to TRUE if
expected, resid, sresid or prop.chisq is
TRUTRUE, the results of a Fisher Exact test will
be included.TRUE, the results of a McNemar test will
be included.TRUE, residual (Pearson) will be included. The value
of resid will be set to FALSE if format = "SAS".TRUE, standardized residual will be included. The
value of sresid will be set to FALSE if format =
"SAS".TRUE, adjusted standardized residual will be
included. The value of asresid will be set to FALSE if
format = "SAS".TRUE, then remove any unused factor levels.TRUE, print the cell layout.title).title).chisq.test.CrossTable containing parameters used by the
print.CrossTable method and the following components:t: An n by m matrix containing table cell counts.
prop.row: An n by m matrix containing cell row proportions.
prop.col: An n by m matrix containing cell column 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 1: If 'x' is a vector and 'y' is not specified, no statistical tests will
be performed, even if any are set to TRUE.
Note 2: 'x' and 'y' labels will be truncated if the table is not going to
fit to the screen, according to the value of getOption("width").
forODFTable, table,
prop.table, xtabs,
crosstab.# Simple cross tabulation of education versus prior induced
# abortions using infertility data
data(warpbreaks, package = "datasets")
CrossTable(warpbreaks$wool, warpbreaks$tension,
dnn = c("Wool", "Tension"))Run the code above in your browser using DataLab