An extension for stats::t.test with added boni and tidy and/or pretty output. The result is either returned as a broom::tidy data.frame or prettified using various pixiedust::sprinkle shenanigans.

tadaa_t.test(
  data,
  response,
  group,
  direction = "two.sided",
  paired = FALSE,
  var.equal = FALSE,
  conf.level = 0.95,
  print = c("df", "console", "html", "markdown")
)

Arguments

data

A data.frame.

response

The response variable (dependent).

group

The group variable, usually a factor.

direction

Test direction, like alternative in t.test.

paired

If TRUE, a paired test is performed, defaults to FALSE.

var.equal

If set, passed to stats::t.test to decide whether to use a Welch-correction. Default is FALSE to automatically use a Welch-test, which is in general the safest option.

conf.level

Confidence level used for power and CI, default is 0.95.

print

Print method, default df: A regular data.frame. Otherwise passed to pixiedust::sprinkle_print_method for fancyness.

Value

A data.frame by default, otherwise dust object, depending on print.

See also

Examples

set.seed(42) df <- data.frame(x = runif(100), y = sample(c("A", "B"), 100, TRUE)) tadaa_t.test(df, x, y)
#> # A tibble: 1 x 12 #> estimate estimate1 estimate2 statistic se parameter conf.low conf.high #> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 0.0349 0.540 0.505 0.579 0.0603 97.1 -0.0847 0.154 #> # … with 4 more variables: p.value <dbl>, d <dbl>, method <chr>, #> # alternative <chr>
df <- data.frame(x = runif(100), y = c(rep("A", 50), rep("B", 50))) tadaa_t.test(df, x, y, paired = TRUE)
#> # A tibble: 1 x 12 #> estimate estimate1 estimate2 statistic se parameter conf.low conf.high #> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 0.0326 0.457 0.424 0.485 0.0671 49 -0.102 0.167 #> # … with 4 more variables: p.value <dbl>, d <dbl>, method <chr>, #> # alternative <chr>
tadaa_t.test(ngo, deutsch, geschl, print = "console")
#> Table 3: **Welch Two Sample t-test** with alternative hypothesis: $\mu_1 \neq \mu_2$ #> #> Diff $\\mu_1$ Männlich $\\mu_2$ Weiblich t SE df $CI_{95\\%}$ #> 1 -1.03 7.09 8.12 -4.11 0.25 247.43 (-1.53 - -0.54) #> p Cohen\\'s d #> 1 < .001 -0.52 #> #>