I want to conditionally summarize several variables by group. The following code does that, but I\'m not sure how to do this without specifying each variable and the conditions