group_means function

Compute column-wise mean in X for each factor level of Y