crosstab: Crosstab variables

Description Usage Arguments Value See Also Examples

View source: R/categorical.R

Description

Computes contingency table for one independent (column) variable and one or more dependent (row) variables.

Usage

1
2
3
4
5
6
7
8
crosstab(
  data,
  col_var,
  ...,
  add_total = FALSE,
  percentages = FALSE,
  chi_square = FALSE
)

Arguments

data

a tibble

col_var

Independent (column) variable.

...

Dependent (row) variables.

add_total

Logical indicating whether a 'Total' column should be computed. Defaults to FALSE.

percentages

Logical indicating whether to output column-wise percentages instead of absolute values. Defaults to FALSE.

chi_square

Logical indicating whether a Chi-square test should be computed. Test results will be reported via message(). Defaults to FALSE.

Value

a tibble

See Also

Other categorical: tab_frequencies()

Examples

1
2
WoJ %>% crosstab(reach, employment)
WoJ %>% crosstab(reach, employment, add_total = TRUE, percentages = TRUE, chi_square = TRUE)

tidycomm documentation built on July 6, 2021, 5:07 p.m.