tidy() and glance() methods for objects of class rstatix_test — the result of a test function such as t_test(), wilcox_test(), anova_test() or kruskal_test(). The results are already tidy tibbles; these methods drop the internal rstatix classes and the stashed test arguments so the object passes cleanly to tools that dispatch on tidy / glance, such as broom, gtsummary and gt. Correlation results (cor_test(), cor_mat()) carry a different class and are not covered by these methods.

# S3 method for class 'rstatix_test'
tidy(x, ...)

# S3 method for class 'rstatix_test'
glance(x, ...)

Arguments

x

an object of class rstatix_test, as returned by an rstatix test function.

...

not used; present for compatibility with the generics.

Value

tidy() returns the same result as a plain tibble, one row per comparison or model term, with the internal classes and the args attribute removed. glance() returns a one-row tibble with the test method and n, the number of rows in the result (the number of comparisons or model terms).

Examples

res <- ToothGrowth %>% t_test(len ~ dose)

# A plain tibble, ready for broom / gtsummary / gt
tidy(res)
#> # A tibble: 3 × 10
#>   .y.   group1 group2    n1    n2 statistic    df        p    p.adj p.adj.signif
#>   <chr> <chr>  <chr>  <int> <int>     <dbl> <dbl>    <dbl>    <dbl> <chr>       
#> 1 len   0.5    1         20    20     -6.48  38.0 1.27e- 7 2.54e- 7 ****        
#> 2 len   0.5    2         20    20    -11.8   36.9 4.40e-14 1.32e-13 ****        
#> 3 len   1      2         20    20     -4.90  37.1 1.91e- 5 1.91e- 5 ****        

# One-row summary
glance(res)
#> # A tibble: 1 × 2
#>   method     n
#>   <chr>  <int>
#> 1 t_test     3