title: calculate average of each column based on values in another column in R
body: <p>with the built-in dataframe mtcars, let's say I want to calculate the average each column based on the values in column 'carb'. How do I do that?</p>