crosstab: Crosstab variables

View source: R/categorical.R

crosstabR Documentation

Crosstab variables

Description

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

Usage

crosstab(
  data,
  col_var,
  ...,
  add_total = FALSE,
  percentages = FALSE,
  chi_square = FALSE
)

Arguments

data

a tibble or a tdcmm model

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 tdcmm model

See Also

Other categorical: tab_frequencies()

Examples

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


joon-e/tidycomm documentation built on Feb. 24, 2024, 8:58 a.m.