Learn R Programming

tidystats (version 0.3)

tidy_stats.htest: Create a tidy stats data frame from an htest object

Description

tidy_stats.htest takes an htest object and converts the object to a tidy stats data frame.

Usage

# S3 method for htest
tidy_stats(model)

Arguments

model

Output of t.test().

Examples

Run this code
# NOT RUN {
# Conduct a t-test
model_t_test <- t.test(extra ~ group, data = sleep)
tidy_stats(model_t_test)

# Conduct a correlation
x <- c(44.4, 45.9, 41.9, 53.3, 44.7, 44.1, 50.7, 45.2, 60.1)
y <- c( 2.6,  3.1,  2.5,  5.0,  3.6,  4.0,  5.2,  2.8,  3.8)

model_correlation <- cor.test(x, y)
tidy_stats(model_correlation)

# Conduct a chi-square test
M <- as.table(rbind(c(762, 327, 468), c(484, 239, 477)))

model_chi_square <- chisq.test(M)
tidy_stats(model_chi_square)

# }

Run the code above in your browser using DataLab