groupedstats (version 0.0.7)

grouped_ttest: Function to run t-test on multiple variables across multiple grouping variables.

Description

Function to run t-test on multiple variables across multiple grouping variables.

Usage

grouped_ttest(data, dep.vars, indep.vars, grouping.vars, paired = FALSE,
  var.equal = FALSE)

Arguments

data

Dataframe from which variables are to be taken.

dep.vars

List dependent variables for a t-test (y in y ~ x).

indep.vars

List independent variables for a t-test (x in y ~ x).

grouping.vars

List of grouping variables.

paired

A logical indicating whether you want a paired t-test (Default: paired = FALSE; independent t-test, i.e.).

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 (Default: var.equal = FALSE; Welch's t-test, i.e.).

Value

A tibble dataframe with tidy results from t-test analyses.

Examples

Run this code
# NOT RUN {
groupedstats::grouped_ttest(
  data = dplyr::filter(.data = ggplot2::diamonds, color == "E" | color == "J"),
  dep.vars = c(carat, price, depth),
  indep.vars = color,
  grouping.vars = clarity,
  paired = FALSE,
  var.equal = FALSE
)
# }

Run the code above in your browser using DataLab