I've the a data frame containing different items (and it's cost) and also it's subsequent groupings. I would like to run an Anova and/or T-Test for each item based on their groupings to see if their mean differs. Anybody knows how to do this in R?
A sample of the dataframe is as follow:
Item | Cost | Grouping |
---|---|---|
Book A | 7 | A |
Book A | 9 | B |
Book A | 6 | A |
Book A | 7 | B |
Book B | 4 | A |
Book B | 6 | B |
Book B | 5 | A |
Book B | 3 | C |
Book C | 5 | C |
Book C | 4 | A |
Book C | 7 | C |
Book C | 2 | B |
Book C | 2 | B |
Book D | 4 | A |
Book D | 2 | C |
Book D | 9 | C |
Book D | 4 | A |
The output should be a simple table (or any similar table) as follows
Item | P-Value (from ANOVA/t-test) (H0: Mean same for all groupings) |
---|---|
Book A | xxx |
Book B | xxx |
Book C | xxx |
Book D | xxx |
Thanks in advance!