nice_chi_test_table: Creates a chi.squared test table for multiple dependent...

View source: R/nice_chi_test_table.R

nice_chi_test_tableR Documentation

Creates a chi.squared test table for multiple dependent variables

Description

Creates a chi.squared test table for multiple dependent variables

Usage

nice_chi_test_table(
  dv,
  iv,
  data,
  conditions = levels(factor(iv))[1:2],
  ref_levels = 2,
  labels = NULL,
  nice_p = TRUE,
  digits = 2,
  order = "12",
  label_attr = TRUE,
  type = "html",
  ...
)

chi_test_table(...)

Arguments

dv

A data frame with the dependent variables or a character vector when argument data is set.

iv

A data frame or vector with the independent variable or a character if argument data is set.

data

A data frame.

conditions

A character vector of length two with the names of the two conditions. Defaults to the first two levels of the independent variable 'iv' if applicable.

ref_levels

Vector with the reference level for each dependent variable. Values are repeated if length of levels vector is smaller than number dependent variables.

labels

A character vector of length two with labels for the dependent variables.

nice_p

If TRUE, p values are printed in a nice format.

digits

Number of digits for rounding mean and sd values

order

Either "12" or "21" depicting whether group two is compared to group one or vice versa.

type

Either "df" for data frame or "html" for html table.

...

Further arguments passed to nice_table()

Value

A tibble or an html table

Examples

dat <- data.frame(
  gender = factor(rbinom(100, 1, 0.3), labels = c("male", "female")),
  glasses = factor(rbinom(100, 1, 0.3), labels = c("no", "yes")),
  sen = factor(rbinom(100, 1, 0.5), labels = c("no_sen", "sen"))
 )
chi_test_table(
  c("gender", "glasses"), "sen", data = dat, 
  ref_levels = c("male", "no")
)

jazznbass/wmisc documentation built on Oct. 29, 2024, 5:42 p.m.