IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Reshaping Data with tidyr

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

medal_df %>% 
  # Count the medals won per team and year
  ___(___, ___, name = "n_medals")
Modifica ed esegui il codice