Skip to contents

Pearson's Chi-squared test or Fisher's exact test or Cochran-Mantel-Haenszel Chi-Squared Test

Usage

wrapper_pearsons_test_core(
  data,
  response_var,
  covariate_var,
  strata_vars = NULL,
  method = "pearson",
  variable_names = NULL,
  caption = NULL,
  force_empty_cols = FALSE,
  print_total = TRUE,
  print_non_response = TRUE,
  print_pvalues = TRUE
)

wrapper_pearsons_test_core_strat(
  data,
  response_var,
  covariate_var,
  strata_vars = NULL,
  strat1_var = NULL,
  strat2_var = NULL,
  method = "pearson",
  variable_names = NULL,
  caption = NULL,
  force_empty_cols = FALSE,
  print_total = TRUE,
  print_non_response = TRUE,
  print_pvalues = TRUE,
  print_adjpvalues = TRUE
)

Arguments

data

Data frame.

response_var

Name of categorical variable defining successes and failures where the first level corresponds to failure and the second level corresponds to success.

covariate_var

Name of categorical variable defining subgroups.

strata_vars

Stratification factors. If defined, then the Cochran-Mantel-Haenszel Chi-Squared Test is applied.

method

Method 'pearson' or 'fisher' test.

variable_names

Named vector with variable names. If not supplied, variable names are created by replacing in column names underscores with spaces.

caption

Caption for the table with results.

force_empty_cols

Logical. Whether to display output columns which are all empty.

print_total

Logical. Whether to print total number of samples.

print_pvalues

Logical. Whether to print p-values.

strat1_var

Name of the second stratification variable.

print_adjpvalues

Logical. Whether to print adjusted p-values.