Learn R Programming

descr (version 0.3.0)

crosstab: Cross tabulation

Description

Outputs a cross table for two factors.

Usage

crosstab(x, y, weight = NULL, digits = 3, max.width = 5, expected = FALSE,
        prop.r = FALSE, prop.c = FALSE, prop.t = FALSE, prop.chisq = FALSE,
        chisq = FALSE, fisher = FALSE, mcnemar = FALSE, resid = FALSE,
        sresid = FALSE, asresid = FALSE, missing.include = FALSE,
        format = "SPSS", dnn = NULL, plot = getOption("descr.plot"),
        main = "", xlab = deparse(substitute(x)), ylab = deparse(substitute(y)),
        col = gray.colors(length(levels(y))), ...)

Arguments

x, y
Vectors in a matrix or a dataframe.
weight
An optional vector for a weighted cross tabulation.
digits
max.width
expected
prop.r
prop.c
prop.t
prop.chisq
chisq
fisher
mcnemar
resid
sresid
asresid
missing.include
format
dnn
plot
Logical: if TRUE (default), a mosaic plot is produced. You may put options(descr.plot = FALSE) in your .Rprofile to change the default function behavior.
main
An overall title for the plot (see title).
xlab
A title for the x axis (see title).
ylab
A title for the y axis (see title).
col
A specification for the default plotting color. (See section Color Specification of par).
...
Further arguments to be passed to mosaicplot.

Details

crosstab invokes the CrossTable function in the gmodels package with all boolean options set to FALSE and "SPSS" as the default format option.

See Also

CrossTable