| diving | R Documentation |
One hundred years of Men's Olympic Platform Diving records.
data(diving)
A data.frame object with 695 observations and 13 columns.
The columns are defined as follows:
NameThe participant's name.
AgeThe age of the participant at the time of the Olympics. Some values missing.
HeightThe height of the participant at the time of the Olympics, in centimeters. Many values missing.
WeightThe height of the participant at the time of the Olympics, in kilograms. Many values missing.
TeamThe string name of the team (country) which the participant represented.
NOCThe string name of the National Olympic Committee which the participant represented. This is a three character code.
GamesThe string name of the Olympic games, including a year.
YearThe integer year of the Olympics. These range from 1906 through 2016.
CityThe string name of the host city.
MedalA string of “Gold”, “Silver”,
“Bronze” or NA.
EventIdA unique integer ID for each Olympics.
AthleteIdA unique integer ID for each participant.
HOST_NOCThe string name of the National Olympic Committee of the nation hosting the Olympics. This is a three character code.
The author makes no guarantees regarding correctness of this data.
Please attribute this data to the upstream harvester.
Steven E. Pav shabbychef@gmail.com
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.