Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cross

Crosstabs


Description

Functions to display (2 x 2) contingency table

Usage

cross(x, ...)

Arguments

x

Object of type table or formula, vector to tabulate

...

Arguments passed to table of xtabs

Details

The xtab functions corrects the inability to deal with missing values in the original xtabs that comes with R base.

Value

The cross methods returns an object of type cross with the original table and the marginal percentages by row and by column. A print methods is associated with a cross object. xtab returns an object of type table (see details). Total returns a sum with na.rm=TRUE by default and replaces NA with 0.

Author(s)

Charles-Édouard Giguère

Examples

require(CUFF)
### example of crosstabs
cr1 <- cross( ~ N + P, npk)
print(cr1, test = c("chisq.test", "fisher.test"))

CUFF

Charles's Utility Function using Formula

v1.7
GPL (>= 2)
Authors
Charles-Édouard Giguère
Initial release
2020-09-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.