Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Final quiz

Instruction

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

Exercise

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.

Type:

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