t_test: Compute t-tests

Description Usage Arguments Value Examples

View source: R/ttest.R

Description

Computes t-tests for one group variable and specified test variables. If no variables are specified, all numeric (integer or double) variables are used.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
t_test(
  data,
  group_var,
  ...,
  var.equal = TRUE,
  paired = FALSE,
  pooled_sd = TRUE,
  levels = NULL,
  case_var = NULL
)

Arguments

data

a tibble

group_var

group variable (column name)

...

test variables (column names). Leave empty to compute t-tests for all numeric variables in data.

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. Defaults to TRUE.

paired

a logical indicating whether you want a paired t-test. Defaults to FALSE.

pooled_sd

a logical indicating whether to use the pooled standard deviation in the calculation of Cohen's d. Defaults to TRUE.

levels

optional: a vector of length two specifying the two levels of the group variable.

case_var

optional: case-identifying variable (column name). If you set paired = TRUE, specifying a case variable will ensure that data are properly sorted for a dependent t-test.

Value

a tibble

Examples

1
2
3
4
WoJ %>% t_test(temp_contract, autonomy_selection, autonomy_emphasis)
WoJ %>% t_test(temp_contract)
WoJ %>% t_test(employment, autonomy_selection, autonomy_emphasis,
  levels = c("Full-time", "Freelancer"))

tidycomm documentation built on July 6, 2021, 5:07 p.m.