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 mutates slower.
Latihan ini adalah bagian dari kursus
Data Manipulation with dplyr
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
babynames %>%
# Add columns name_total and name_max for each name
___