Zero Olympic medals
Since 1896, athletes from all over the world have been competing in the modern Olympic games. You've been given a dataset (medal_df
) with observations for all medals won by athletes from the 10 most successful countries in Olympic history. You want to create a visual with the number of medals won per country (team
) per year
. However, since not all countries won medals each year, you'll have to introduce zero values before you can make an accurate visual.
The ggplot2
and dplyr
packages have been pre-loaded for you. In step 2 and 3 the scale_color_brewer()
function is used to color lines in the plot with a palette that makes it easier to distinguish the different countries.
Diese Übung ist Teil des Kurses
Reshaping Data with tidyr
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
medal_df %>%
# Count the medals won per team and year
___(___, ___, name = "n_medals")