Save up to $499! Grab all Python courses for $49 or all online courses we’ve ever launched for only $169. Only Feb 11-16. Happy Valentine's!
Final quiz


Now, let's see whether there are any differences in travel and health expenses among different age groups.


Calculate the mean and median expenses on "health" and "travel" (using the category column) for the different age groups (using the age_group column). Use the data found in survey_long.
Note: use the %>% operator.

Stuck? Here's a hint!

First, filter() the data for "health" and "travel" expenses. Then, group_by the two columns and calculate the appropriate statistics.


survey_long %>%
  filter(category %in% c("health", "travel")) %>%
  group_by(age_group, category) %>%
  summarize(mean(value), median(value))