I want to run a t.test for 4 datasets but i was wondering if there is a method that automatically run the t.test for all the combinations of the groups of my datasets.Thank you
Asked
Active
Viewed 421 times
1 Answers
0
It is usually helpful to provide an example of what it is you are trying to do -- how your data is structured, what you've tried, and how you might want the output to look.
That said, if I'm understanding what you are asking correctly, you just want to run multiple t-tests over a data set and return a result for each combination of pairs.
If so, maybe the pairwise_t_test
function from the rstatix
package would be useful to you.
library(tidyverse)
library(rstatix)
### t-test across for multiple groups
pairwise_t_test(Sepal.Length ~ Species, p.adjust.method = "bonferroni", data = iris)

user3585829
- 945
- 11
- 24
-
next time i will provide an example also just to be more clear of what i ask. However, the command that you gave me is excatly what i was looking for. Thank you – pipts Jan 29 '21 at 21:01
-
Great! Glad to hear it. Can you please accept the answer so that it gets tagged properly? – user3585829 Jan 30 '21 at 01:11