Skip to contents

Run Kruskal-Wallis H test or Wilcoxon Rank-Sum test for multiple covariates

Usage

wrapper_kruskal_test(
  data,
  num_vars,
  cat_vars,
  strat1_var = NULL,
  strat2_var = NULL,
  method = "kruskal",
  alternative = "two.sided",
  paired = FALSE,
  pairwise = FALSE,
  variable_names = NULL,
  caption = NULL,
  display_statistics = NULL,
  display_in_column = "cat",
  force_empty_cols = FALSE,
  print_pvalues = TRUE,
  print_adjpvalues = TRUE,
  drop = FALSE
)

Arguments

data

Data frame.

num_vars

Vector with names of numerical variables. If it has length >= 1, then 'cat_var' must be of length 1, and stratification subgroups are displayed in columns and statistics in rows.

cat_vars

Vector with names of categorical variables. If it has length >= 1, then 'num_var' must be of length 1, and stratification subgroups are displayed in rows and statistics in columns.

strat1_var

Name of the second stratification variable.

method

Test to be used. Possible values: "kruskal", "wilcox", "t".

paired

Logical. Paired test is possible only for wilcox and t. The data must be ordered by the pairing variable, usually subject ID.

display_statistics

Vector of possible values: "N", "Median", "Mean", "Min", "Max", "First.Quartile", "Third.Quartile".

display_in_column

Possible values: "cat", "num".