Learn R Programming

GimmeMyStats (version 1.0.0)

print_test: Prints a hypothesis test

Description

Formats the results of a hypothesis test (ANOVA, Kruskal-Wallis, or Wilcoxon).

Usage

print_test(x, digits = 0, digits_p = 2)

Value

A character string containing the formatted test results with:

Test name

Name of the statistical test (ANOVA, Kruskal-Wallis, Wilcoxon, t-test, Friedman, or mixed-effects model).

Test statistic

Test statistic (F, K, W, T, or \(\chi^2\)) with degrees of freedom when applicable.

P-value

P-value with significance stars.

Arguments

x

Test object from rstatix among anova_test, kruskal_test, or wilcox_test.

digits

Integer specifying the number of decimal places for the test statistic.

digits_p

Integer specifying the number of decimal places for the p-value.

Examples

Run this code
library(rstatix)
data("ToothGrowth")
res <- anova_test(ToothGrowth, len ~ dose)
print_test(res)

res <- kruskal_test(ToothGrowth, len ~ dose)
print_test(res)

res <- wilcox_test(ToothGrowth, len ~ supp)
print_test(res)

library(lmerTest)
data("sleepstudy", package = "lme4")
res <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
print_test(res)

Run the code above in your browser using DataLab