crosstabs: Crosstabulation of two variables

Description Usage Arguments Value Note Examples

View source: R/crosstabs.R

Description

Produces a 2-way table of counts and the corresponding chi-square test of independence or homogeneity.

Usage

1

Arguments

formula

a symbolic description of the model to be fit: ~ fac1 + fac2; where fac1 and fac2 are vectors to be crosstabulated and treated internally as factors.

data

an optional data frame containing the variables in the model.

Value

An invisible list containing the following components:

row.props

a matrix of row proportions, i.e. cell counts divided by row marginals.

col.props

a matrix of column proportions, i.e. cell counts divided by column marginals.

Totals

a matrix containing the cell counts and the marginal totals.

Note

This function is deprecated and will be removed in future versions of the package.

Examples

1
2
3
##body image data:
data(body.df)
crosstabs(~ ethnicity + married, body.df)

s20x documentation built on Aug. 23, 2021, 9:15 a.m.

Related to crosstabs in s20x...