Created
April 17, 2018 17:03
-
-
Save jalapic/e9ede23a3849c2d012690842e98f09cc to your computer and use it in GitHub Desktop.
top tier point differences
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(engsoccerdata) | |
library(tidyverse) | |
england %>% | |
filter(tier==1) %>% | |
split(.$Season) %>% | |
map(function(x) maketable_eng(x, Season = x$Season[1], tier=1, penalties=T) ) %>% | |
map(~summarise(., diff = Pts[Pos==1] - Pts[Pos==2])) %>% | |
bind_rows %>% | |
ggplot(aes(x=diff))+geom_histogram(color='black', fill="gray62", binwidth = 1) + scale_x_continuous(breaks = seq(0,20,2)) + | |
theme_bw() + ylab("Frequency") + xlab("Points difference") + | |
ggtitle("Final Points Difference Between 1st and 2nd in English Top Tier 1888-2018",subtitle = "Assumes 3 points for a win") | |
### which highest | |
england %>% | |
filter(tier==1) %>% | |
split(.$Season) %>% | |
map(function(x) maketable_eng(x, Season = x$Season[1], tier=1, penalties=T) ) %>% | |
map(~summarise(., diff = Pts[Pos==1] - Pts[Pos==2])) -> d | |
do.call('rbind', Map(cbind, d, Season = names(d))) %>% | |
arrange(-diff) | |
Author
jalapic
commented
Apr 17, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment