diving {ohenery} | R Documentation |
Olympic Diving Data
Description
One hundred years of Men's Olympic Platform Diving records.
Usage
data(diving)
Format
A data.frame
object with 695 observations and 13 columns.
The columns are defined as follows:
Name
The participant's name.
Age
The age of the participant at the time of the Olympics. Some values missing.
Height
The height of the participant at the time of the Olympics, in centimeters. Many values missing.
Weight
The height of the participant at the time of the Olympics, in kilograms. Many values missing.
Team
The string name of the team (country) which the participant represented.
NOC
The string name of the National Olympic Committee which the participant represented. This is a three character code.
Games
The string name of the Olympic games, including a year.
Year
The integer year of the Olympics. These range from 1906 through 2016.
City
The string name of the host city.
Medal
A string of “Gold”, “Silver”, “Bronze” or
NA
.EventId
A unique integer ID for each Olympics.
AthleteId
A unique integer ID for each participant.
HOST_NOC
The string name of the National Olympic Committee of the nation hosting the Olympics. This is a three character code.
Note
The author makes no guarantees regarding correctness of this data.
Please attribute this data to the upstream harvester.
Author(s)
Steven E. Pav shabbychef@gmail.com
Source
Data were collected by Randi Griffin from the website “sports-reference.com”, and staged on Kaggle at https://www.kaggle.com/heesoo37/120-years-of-olympic-history-athletes-and-results.
Examples
library(dplyr)
library(forcats)
data(diving)
fitdat <- diving %>%
mutate(Finish=case_when(grepl('Gold',Medal) ~ 1,
grepl('Silver',Medal) ~ 2,
grepl('Bronze',Medal) ~ 3,
TRUE ~ 4)) %>%
mutate(weight=ifelse(Finish <= 3,1,0)) %>%
mutate(cut_age=cut(coalesce(Age,22.0),c(12,19.5,21.5,22.5,25.5,99),include.lowest=TRUE)) %>%
mutate(country=forcats::fct_relevel(forcats::fct_lump(factor(NOC),n=5),'Other')) %>%
mutate(home_advantage=NOC==HOST_NOC)
hensm(Finish ~ cut_age + country + home_advantage,data=fitdat,weights=weight,group=EventId,ngamma=3)