library("psych350lab")
data(superman, package = "psych350data")
result <- chi_square_answers(superman, "clark_grp", "tomatometer")
# Answer KEY
cat(format_chi2_results("RH1", c("clark_grp", "tomatometer"), result,
var1_labels = c("Under 6ft", "6ft+"),
var2_labels = c("Rotten", "Fresh")))
# Blank version
cat(format_chi2_results("RH1", c("clark_grp", "tomatometer"), result,
var1_labels = c("Under 6ft", "6ft+"),
var2_labels = c("Rotten", "Fresh"), KEY = FALSE))Format Chi-Square Results for Fill-in-the-Blank
Description
Returns a formatted text string of chi-square results, either filled in (answer KEY) or blank (student worksheet).
Usage
format_chi2_results(
rh_name,
vars,
chi_results_list,
var1_labels = c("1", "2"),
var2_labels = c("1", "2"),
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 the two levels of the first variable (rows). |
var2_labels
|
Character vector of length 2. Labels for the two levels of the second variable (columns). |
KEY
|
Logical. If TRUE (default), show answers; if FALSE, show blanks.
|
Value
A character string with formatted results.