my_data <- data.frame(
w = sample(1:5, 10, replace = TRUE),
x = sample(1:5, 10, replace = TRUE),
y = sample(1:5, 10, replace = TRUE),
z = sample(1:5, 10, replace = TRUE),
my_group = sample(1:3, 10, replace = TRUE)
)
I would want to find the mean of each column within each group. i.e i'd want the mean of columns (w,x,y,z) with rescpect to the three different groups