broom (version 0.4.1)

htest_tidiers: Tidying methods for an htest object

Description

Tidies hypothesis test objects, such as those from cor.test, t.test, and wilcox.test, into a one-row data frame.

Usage

"tidy"(x, ...)
"glance"(x, ...)

Arguments

x
An object of class "htest"
...
extra arguments (not used)

Value

Both tidy and glance return the same output, a one-row data frame with one or more of the following columns:
estimate
Estimate of the effect size
statistic
Test statistic used to compute the p-value
p.value
P-value
parameter
Parameter field in the htest, typically degrees of freedom
conf.low
Lower bound on a confidence interval
conf.high
Upper bound on a confidence interval
estimate1
Sometimes two estimates are computed, such as in a two-sample t-test
estimate2
Sometimes two estimates are computed, such as in a two-sample t-test
method
Method used to compute the statistic as a string
alternative
Alternative hypothesis as a string
Which columns are included depends on the hypothesis test used.

Details

No augment method is provided for "htest", since there is no sense in which a hypothesis test generates one value for each observation.

Examples

Run this code

tt <- t.test(rnorm(10))
tidy(tt)
glance(tt)  # same output for all htests

tt <- t.test(mpg ~ am, data = mtcars)
tidy(tt)

wt <- wilcox.test(mpg ~ am, data = mtcars)
tidy(wt)

ct <- cor.test(mtcars$wt, mtcars$mpg)
tidy(ct)

Run the code above in your browser using DataLab