janitor (version 1.2.1)

crosstab: Generate a crosstabulation of two vectors.

Description

This function is deprecated, use tabyl(dat, var1, var2) instead.

Usage

crosstab(...)

# S3 method for default crosstab(vec1, vec2, percent = "none", show_na = TRUE, ...)

# S3 method for data.frame crosstab(.data, ...)

Arguments

...

additional arguments, if calling crosstab on a data.frame.

vec1

the vector to place on the crosstab column. If supplying a data.frame, this should be an unquoted column name.

vec2

the vector to place on the crosstab row. If supplying a data.frame, this should be an unquoted column name.

percent

which grouping to use for percentages, if desired (defaults to "none", which returns simple counts). Must be one of "none", "row", "col", or "all".

show_na

a logical value indicating whether counts should be displayed where either variable is NA.

.data

(optional) a data.frame, in which case vec1 and vec2 should be unquoted column names.

Value

Returns a data.frame with the frequencies of the crosstabulated variables.