powered by
Produces a 2-way table of counts and the corresponding chi-square test of independence or homogeneity.
crosstabs(formula, data)
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.
an optional data frame containing the variables in the model.
An invisible list containing the following components:
a matrix of row proportions, i.e. cell counts divided by row marginals.
a matrix of column proportions, i.e. cell counts divided by column marginals.
a matrix containing the cell counts and the marginal totals.
# NOT RUN { ##body image data: data(body.df) crosstabs(~ ethnicity + married, body.df) # }
Run the code above in your browser using DataLab