Chi-Square Combined Results Table

Description

Creates a compact flextable combining chi-square test results with frequency counts in a single table. Row 1 shows chi-square statistics, rows 2-3 show frequency counts per variable level.

Usage

create_chi_combined_table(
  rh_name,
  vars,
  chi_results_list,
  var1_labels = c("Level 1", "Level 2"),
  var2_labels = c("Level A", "Level B"),
  KEY = TRUE
)

Arguments

rh_name Character. Research hypothesis name/label.
vars Character vector of length 2. Variable names.
chi_results_list Output from chi_square_answers().
var1_labels Character vector of length 2. Labels for var1 levels.
var2_labels Character vector of length 2. Labels for var2 levels.
KEY Logical. If TRUE, fill with values; if FALSE, blank.

Value

A flextable::flextable() object.

Examples

library("psych350lab")

data(superman, package = "psych350data")
result <- chi_square_answers(superman, "clark_grp", "tomatometer")
ft <- create_chi_combined_table("RH1", c("clark_grp", "tomatometer"),
  result,
  var1_labels = c("Under 6ft", "6ft+"),
  var2_labels = c("Rotten", "Fresh"))
ft