nice_t_test_table: Creates a t.test table for multiple dependent variables

View source: R/nice_t_test_table.R

nice_t_test_tableR Documentation

Creates a t.test table for multiple dependent variables

Description

Creates a t.test table for multiple dependent variables

Usage

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")
)

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")
)

jazznbass/wmisc documentation built on Oct. 29, 2024, 5:42 p.m.