Perform multiple paired t-tests based on groups/categories

The tidy way of doing it is using dplyr and broom: library(dplyr) library(broom) df <- data %>% group_by(Product_type) %>% do(tidy(t.test(.$Price_Online, .$Price_Offline, mu = 0, alt = “two.sided”, paired = TRUE, conf.level = 0.99)))) Much more readable than my base r solution, and it handles the column names for you! EDIT A more idiomatic way to … Read more