rstatix icon indicating copy to clipboard operation
rstatix copied to clipboard

`detailed = TRUE`: Output could mention correct method used

Open ddauber opened this issue 3 years ago • 1 comments

This is somewhat linked to #23. When retrieving the full output with detailed = TRUE, it should return the correct method.

For example, the distinction between T-test and Welch T-test does matter. This information is provided through the underlying function.

This would be especially useful when writing one's paper or report using markdown because you can easily extract the method automatically rather than manually editing the file. This is not a problem for one test, but if one runs several comparisons with different methods, it could become confusing quickly.

I can see how it might be an easy fix since you likely already use method to generate the tibble output. Certianly nothing major as long as you know what you are doing, but maybe more an 'enhancement' rather than an 'issue' 😉

library(rstatix)
#> 
#> Attaching package: 'rstatix'
#> The following object is masked from 'package:stats':
#> 
#>     filter

# T-Test
df <- ToothGrowth
df %>% t_test(len ~ supp,
              var.equal = TRUE,
              detailed = TRUE) %>% 
  select(method)
#> # A tibble: 1 × 1
#>   method
#>   <chr> 
#> 1 T-test

# Welch T-test
df %>% t_test(len ~ supp,
              var.equal = FALSE,
              detailed = TRUE) %>% 
  select(method)
#> # A tibble: 1 × 1
#>   method
#>   <chr> 
#> 1 T-test

# The method of underlying function 
test <- t.test(len ~ supp,
              var.equal = FALSE,
              data = df)

test$method
#> [1] "Welch Two Sample t-test"

PS: The same is true for some other functions too, e.g. 'wilcoxon_test(paired = FALSE)' should be 'Mann-Whitney U', etc.

ddauber avatar Aug 25 '21 09:08 ddauber

Hi

Is this package still maintained? If not, I might as well close the issue.

ddauber avatar Mar 22 '24 09:03 ddauber