Adding the total and maximum for each name
In the video, you learned how you could group by the year and use mutate()
to add a total for that year.
In these exercises, you'll learn to normalize by a different, but also interesting metric: you'll divide each name by the maximum for that name. This means that every name will peak at 1.
Once you add new columns, the result will still be grouped by name. This splits it into 48,000 groups, which actually makes later steps like mutate
s slower.
This exercise is part of the course
Data Manipulation with dplyr
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
babynames %>%
# Add columns name_total and name_max for each name
___