Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Data Manipulation with dplyr

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

babynames %>%
  # Add columns name_total and name_max for each name
  ___
  
Code bewerken en uitvoeren