Chapter 11 Trend of rankings of Serena Williams
plotTrendsRankings = function(players_rankings,firstname,lastname,plottitle)
{
players_rankings %>%
filter(first_name == firstname) %>%
filter(last_name == lastname) %>%
mutate(YearMonth = make_date(year=year,month=month) ) %>%
ggplot(aes(x=YearMonth,y=ranking,group = 1)) +
geom_point(size=2, color="red") +
labs(x = 'Time', y = 'ranking',title = plottitle) +
theme_bw()
}
plotTrendsRankings(players_rankings,"Serena","Williams","Trend of Ranking for Serena Williams")
11.1 Rankings above 100
rankingsAboveThreshold = function(players_rankings,firstname,lastname,threshold)
{
players_rankings %>%
filter(first_name == firstname) %>%
filter(last_name == lastname) %>%
filter(ranking >=threshold)
}
serena100 = rankingsAboveThreshold(players_rankings,"Serena","Williams",100) %>%
select(year,month,ranking) %>%
arrange(desc(ranking))
kable(serena100,"html") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>%
scroll_box(width = "800px")
year | month | ranking |
---|---|---|
1997 | 10 | 453 |
1997 | 10 | 448 |
1997 | 11 | 304 |
2011 | 07 | 175 |
2011 | 07 | 172 |
2011 | 07 | 172 |
2011 | 07 | 169 |
2006 | 07 | 140 |
2006 | 07 | 139 |
2006 | 08 | 110 |
2006 | 05 | 108 |
2006 | 05 | 108 |
2006 | 06 | 108 |
2006 | 07 | 108 |
2006 | 07 | 108 |
2006 | 04 | 107 |
2006 | 04 | 107 |
2006 | 04 | 106 |
2006 | 05 | 106 |
2006 | 05 | 105 |
2006 | 05 | 105 |
2006 | 06 | 104 |
2006 | 06 | 104 |
2006 | 06 | 104 |
2006 | 07 | 104 |
1997 | 11 | 102 |
1997 | 12 | 101 |
1997 | 12 | 101 |
1998 | 01 | 101 |
1997 | 11 | 100 |
It is evident that Serena had rankings dropped past 50 and 100 in the years 2006 and 2011.