Before 95-65 season, The first division of English league has 22 teams which have match 42 for each team(except 88,89,90), but for the balancing I delete the rounds between 38 to 42.
Liverpool <- rbind(Liverpool.home, Liverpool.away) %>% arrange(Date)
season_round <- Liverpool %>% count(Season)
season_round <- season_round$n
rounds <- c()
for(i in 1:length(season_round)){
rounds = append(rounds, 1:season_round[i])
}
Liverpool$rounds = rounds
Liverpool <- Liverpool %>% filter(rounds <= 38)Liverpool.meanbfE <- Liverpool %>% filter(EPL == F) %>% group_by(rounds) %>% summarise(points = mean(points)) %>% mutate(EPL = F)
Liverpool.meanafE <- Liverpool %>% filter(EPL == T) %>% group_by(rounds) %>% summarise(points = mean(points)) %>% mutate(EPL = T)
Liverpool.mean <- rbind(Liverpool.meanbfE,Liverpool.meanafE)
Liverpool.mean <- Liverpool.mean %>% group_by(EPL) %>% mutate(cumpoints = cumsum(points))
Liverpool.mean <- ungroup(Liverpool.mean)
Liverpool.mean <- Liverpool.mean %>% mutate(Season = case_when(Liverpool.mean$EPL == T ~ "After 98",Liverpool.mean$EPL == F ~ "Before 98"))g <- ggplot(Liverpool) + geom_line (aes( rounds , cumpoints , color = EPL, fill = Season),alpha = 0.3)+ geom_line(data = Liverpool.mean, aes(rounds, cumpoints, color = EPL, fill = Season), alpha = 0.8, size = 3)+scale_x_continuous(breaks = seq(1, 38, 2))+scale_y_continuous(breaks = seq(0,90,5))+ ggthemes::theme_fivethirtyeight() + theme(legend.position = "right", legend.direction = "vertical") +labs(subtitle = "Rise and Fall of Liverpool")
gRed : Before EPL
Blue : After EPL
Thick lines are mean points of Before EPL and After EPL