Week 2 Analysis


Background

This is an Analysis on the Olympics by the Mexico Team. This is the proposed question:

What discipline, and what age group earns the most medals in the olympics.

Data Description

# Code to get you started. 
# Only the first 100 observations are shown here because the dataset is really too big to show all of it in a markdown file.
datatable(head(Olympics,100), options=list(lengthMenu = c(3,10,30)), extensions="Responsive")


Data Analysis

mexicoteam <- subset(Olympics, Team == "Mexico")
mexmedals <- subset(mexicoteam, Medal != "NA")
summary(mexmedals)
##        ID                                         Name    Sex   
##  Min.   :   654   Joaqun Capilla Prez               : 4   F:17  
##  1st Qu.: 33238   Humberto Mariles Corts            : 3   M:90  
##  Median : 71370   Mara del Rosario Espinoza Espinoza: 3         
##  Mean   : 65274   Germn Sal Snchez Snchez           : 2         
##  3rd Qu.: 98677   Joaqun Prez de las Heras          : 2         
##  Max.   :133999   Paola Milagros Espinosa Snchez    : 2         
##                   (Other)                           :91         
##       Age            Height          Weight     
##  Min.   :14.00   Min.   :153.0   Min.   :47.00  
##  1st Qu.:22.00   1st Qu.:165.0   1st Qu.:57.00  
##  Median :25.00   Median :172.0   Median :64.00  
##  Mean   :25.79   Mean   :171.2   Mean   :63.82  
##  3rd Qu.:28.50   3rd Qu.:175.0   3rd Qu.:70.00  
##  Max.   :44.00   Max.   :192.0   Max.   :90.00  
##                  NA's   :26      NA's   :31     
##                     Team          NOC              Games         Year     
##  Mexico               :107   MEX    :107   2012 Summer:24   Min.   :1932  
##  30. Februar          :  0   AFG    :  0   1936 Summer:16   1st Qu.:1950  
##  A North American Team:  0   AHO    :  0   1980 Summer:10   Median :1980  
##  Acipactli            :  0   ALB    :  0   1948 Summer: 9   Mean   :1980  
##  Acturus              :  0   ALG    :  0   1968 Summer: 9   3rd Qu.:2012  
##  Afghanistan          :  0   AND    :  0   1984 Summer: 6   Max.   :2016  
##  (Other)              :  0   (Other):  0   (Other)    :33                 
##     Season             City              Sport   
##  Summer:107   London     :33   Diving       :17  
##  Winter:  0   Berlin     :16   Equestrianism:17  
##               Moskva     :10   Football     :16  
##               Mexico City: 9   Boxing       :13  
##               Los Angeles: 8   Athletics    :11  
##               Sydney     : 6   Basketball   :11  
##               (Other)    :25   (Other)      :22  
##                                 Event       Medal   
##  Football Men's Football           :16   Bronze:51  
##  Basketball Men's Basketball       :11   Gold  :30  
##  Athletics Men's 20 kilometres Walk: 6   Silver:26  
##  Diving Men's Platform             : 6              
##  Boxing Men's Bantamweight         : 4              
##  Diving Men's Springboard          : 4              
##  (Other)                           :60
hist(mexmedals$Age, col = "skyblue", xlab = "Age Group", ylab = "Number of Medals Earned", main = "Medals Earned by Age Group")

ggplot(mexmedals, aes(x = factor(mexmedals$Medal), fill = factor(mexmedals$Sport),)) +
  geom_bar(position = "dodge", color = "black") +
  labs(x = "Medal Categories", y = "Number of Medals Earned", factor = "Sports")


Conclusion

As represented above, Mexico’s team Agre group who earns the most medals in yhe olympics es between 20 and 25 years old. And the sports with better performance in the:

Gold Medal Category is : Football

Silver Medal Category is: Diving

Bronze Medal Category is: Equestrianism