crosstab: crosstab

Description Usage Arguments Examples

View source: R/crosstab.R

Description

build cross table from formula

Usage

1
crosstab(data = NULL, x = NULL, layer = NULL)

Arguments

data

data.frame which contains the data, given in x

x

A formula specifying dependent ~ independent.

layer

A third variable which is used to construct a three-dimensional crosstab.

Strictly speaking there is no dependent or independet variable in cross-tabulation. Nevertheless it is common to calculate percentages, for which the distinction between dependent and independent variable is meaningful. crosstab lets you specify the model in a memorizable way.

Examples

1
2
titanic %>%
  crosstab(Survived ~ Sex)

tklebel/crosstabr documentation built on May 16, 2018, 11:30 p.m.