Get startedGet started for free

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.

Olympic flag

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.

This exercise is part of the course

Reshaping Data with tidyr

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

medal_df %>% 
  # Count the medals won per team and year
  ___(___, ___, name = "n_medals")
Edit and Run Code