htest_tidiers {broom} | R Documentation |
Tidies hypothesis test objects, such as those from cor.test
,
t.test
, and wilcox.test
, into a one-row data frame.
## S3 method for class 'htest' tidy(x, ...) ## S3 method for class 'htest' glance(x, ...)
x |
An object of class |
... |
extra arguments (not used) |
No augment
method is provided for "htest"
,
since there is no sense in which a hypothesis test generates one
value for each observation.
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.
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)