Creates a t.test table for multiple dependent variables

nice_t_test_table(
  dv,
  iv,
  data,
  method = "cohen",
  conditions = NULL,
  labels = NULL,
  concise = TRUE,
  nice_p = TRUE,
  digits = 1,
  var_equal = FALSE,
  label_attr = TRUE,
  manova = TRUE,
  type = "html",
  caption = "T-test table",
  alternative = "two.sided",
  file = NULL
)

t_test_table(...)

Arguments

dv

A data frame with the dependent variables or a character vector with variable names when data is defined.

iv

A data frame or vector with the independent variable or a character if data is defined.

data

A data frame.

method

Either "cohen", "glass, or "hedges".

conditions

A character vector of length two with the names of the two conditions. Defaults to the first two levels of the independent variable 'iv' if applicable.

labels

A character vector of length two with labels for the dependent variables.

concise

A more concise table with mean and SD in one column.

nice_p

If TRUE, p values are printed in a nice format.

digits

Number of digits for rounding mean and SD values

var_equal

If FALSE, a t-test for unequal variances is calculated.

type

Either "df" for data frame or "html" for html table.

caption

Table caption is type = "html"

Value

A tibble or an html table

Examples

nice_t_test_table(
  data = mtcars, 
  iv = "am", 
  dv = c("mpg", "cyl", "disp", "hp", "drat", "wt", "qsec", "vs", "gear", "carb")
)
Table
T-test table
Scale
N
M (SD)
d t df p
0 1 0 1
mpg 19 13 17.1 ( 3.8) 24.4 ( 6.2) 1.5 3.77 18.3 <.01
cyl 19 13 6.9 ( 1.5) 5.1 ( 1.6) -1.2 -3.35 25.9 <.01
disp 19 13 290.4 (110.2) 143.5 (87.2) -1.4 -4.20 29.3 <.001
hp 19 13 160.3 ( 53.9) 126.8 (84.1) -0.5 -1.27 18.7 .22
drat 19 13 3.3 ( 0.4) 4.0 ( 0.4) 2.0 5.65 27.2 <.001
wt 19 13 3.8 ( 0.8) 2.4 ( 0.6) -1.9 -5.49 29.2 <.001
qsec 19 13 18.2 ( 1.8) 17.4 ( 1.8) -0.5 -1.29 25.5 .21
vs 19 13 0.4 ( 0.5) 0.5 ( 0.5) 0.3 0.93 25.1 .36
gear 19 13 3.2 ( 0.4) 4.4 ( 0.5) 2.6 6.90 22.6 <.001
carb 19 13 2.7 ( 1.1) 2.9 ( 2.2) 0.1 0.28 16.6 .80
Note. Method for estimating standard deviation: cohen; Manova: Pillai = 0.80; F(10, 21) = 8.36; p = 0.000.
df <- data.frame( a = c(rnorm(85, 50, 10), rnorm(200, 70, 20)), b = c(rnorm(85, 50, 10), rnorm(200, 55, 20)), iv = factor(c(rep("Regular", 85), rep("Special", 100), rep("Restricted", 100))) ) nice_t_test_table( c("a", "b"), "iv", data = df, conditions = c("Restricted","Special"), labels = c("Motivation", "Achievement") )
Table
T-test table
Scale
N
M (SD)
d t df p
Restricted Special Restricted Special
Motivation 100 100 71.4 (22.0) 72.0 (20.8) 0.0 0.18 197.3 .86
Achievement 100 100 55.7 (20.6) 52.2 (20.9) -0.2 -1.20 198.0 .20
Note. Method for estimating standard deviation: cohen; Manova: Pillai = 0.01; F(2, 197) = 0.72; p = 0.489.