Chapter 27 Height of players across years

There has been no significant change in height across years

winner_ht = matches %>% select( winner_name,winner_ht,year)
loser_ht = matches %>% select( loser_name,loser_ht,year)

colnames(winner_ht) = c("name","ht","year")
colnames(loser_ht) = c("name","ht","year")

players_ht = rbind(winner_ht,loser_ht)

players_ht %>%
  group_by(year) %>%
  summarise(HtMedian = median(ht,na.rm = TRUE)) %>%
  ungroup() %>%
  head(20) %>%
  
  ggplot(aes(x = year,y = HtMedian)) +
  geom_bar(stat='identity',colour="white", fill = fillColor2) +
  labs(x = 'Year', 
       y = 'Median Height', 
       title = 'Year and Median Height') +
  theme_bw()

27.1 Tabular Data of Heights across years

players_ht = players_ht %>%
  group_by(year) %>%
  summarise(MedianHeight = median(ht,na.rm = TRUE)) %>%
  ungroup() %>%
  head(20) %>%
  arrange(desc(year))

kable(players_ht,"html") %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>%
  scroll_box(width = "800px")
year MedianHeight
2017 175
2016 174
2015 175
2014 174
2013 174
2012 174
2011 173
2010 173
2009 174
2008 173
2007 173
2006 172
2005 172
2004 173
2003 172
2002 172
2001 170
2000 170
NA NA