This runs pairwise independent-samples t-tests (assuming unequal variance by default, but can be changed) and returns the results and effect sizes in a tidy dataframe. Beware: It will automatically omit missing values.

pairwise_t_tests(
  data,
  outcome,
  groups = NULL,
  p.adjust.method = p.adjust.methods,
  conf_level = 0.95,
  var_equal = FALSE
)

Arguments

data

A dataframe containing the outcome and grouping variable

outcome

The outcome variable in dataframe, or a formula of the form outcome ~ group. If a formula is provided, the group needs to be empty.

groups

The grouping variable (each distinct value will be treated as a level)

p.adjust.method

The method to adjust p-values for multiple comparison (see stats::p.adjust())

conf_level

confidence level of the interval.

var_equal

a logical variable indicating whether to treat the two variances as being equal. If TRUE then the pooled variance is used to estimate the variance otherwise the Welch (or Satterthwaite) approximation to the degrees of freedom is used.

Value

A tibble containing the results of the t-tests with one test per row, including a column (apa) formatted for reporting

Examples

if (FALSE) {
pairwise_t_tests(mtcars, wt, cyl)
pairwise_t_tests(mtcars, wt ~ cyl)
}