Workspace
Lucas Silva/

Olympics Data

0
Beta
Spinner

Olympics

This is a historical dataset on the modern Olympic Games, from Athens 1896 to Rio 2016. Each row consists of an individual athlete competing in an Olympic event and which medal was won (if any).

Not sure where to begin? Scroll to the bottom to find challenges!

suppressPackageStartupMessages(library(tidyverse))

read_csv('data/athlete_events.csv.gz', show_col_types = FALSE)

Data Dictionary

ColumnExplanation
idUnique number for each athlete
nameAthlete's name
sexM or F
ageAge of the athlete
heightIn centimeters
weightIn kilograms
teamTeam name
nocNational Olympic Committee 3
gamesYear and season
yearInteger
seasonSummer or Winter
cityHost city
sportSport
eventEvent
medalGold, Silver, Bronze, or NA

Source and license of the dataset. The dataset is a consolidated version of data from www.sports-reference.com.

Don't know where to start?

Challenges are brief tasks designed to help you practice specific skills:

  • 🗺️ Explore: In which year and city did the Netherlands win the highest number of medals in their history?
  • 📊 Visualize: Create a plot visualizing the relationship between the number of athletes countries send to an event and the number of medals they receive.
  • 🔎 Analyze: In which sports does the height of an athlete increase their chances of earning a medal?

Scenarios are broader questions to help you develop an end-to-end project for your portfolio:

You are working as a data analyst for an international judo club. The owner of the club is looking for new ways to leverage data for competition. One idea they have had is to use past competition data to estimate the threat of future opponents. They have provided you with a dataset of past Olympic data and want to know whether you can use information such as the height, weight, age, and national origin of a judo competitor to estimate the probability that they will earn a medal.

You will need to prepare a report that is accessible to a broad audience. It should outline your steps, findings, and conclusions.


✍️ If you have an idea for an interesting Scenario or Challenge, or have feedback on our existing ones, let us know! You can submit feedback by pressing the question mark in the top right corner of the screen and selecting "Give Feedback". Include the phrase "Content Feedback" to help us flag it in our system.

Summary

In this report, I will move forward with one of the basics of Olympics data.

# Read the dataset
library(tidyverse)
olympics <- read_csv('data/athlete_events.csv.gz', show_col_types = FALSE)

# Group the data by year and calculate the average height
height_by_year <- olympics %>%
  filter(!is.na(height)) %>%
  group_by(year) %>%
  summarize(avg_height = mean(height))

# Create the ggplot2
ggplot(height_by_year, aes(x = year, y = avg_height)) +
  geom_line() +
  labs(title = "Average Height of Olympic Athletes Over the Years",
       x = "Year",
       y = "Average Height (cm)") +
  theme_minimal()
Current Type: Bar
Current X-axis: year
Current Y-axis: avg_height
Current Color: None