# excel file
Prem <- read_excel("../00_data/Premier League Match Data 21-22.xlsx")
Prem
## # A tibble: 380 × 22
## Date HomeTeam AwayTeam FTHG FTAG FTR HTHG HTAG HTR Referee HS
## <chr> <chr> <chr> <dbl> <dbl> <chr> <dbl> <dbl> <chr> <chr> <dbl>
## 1 13/08/20… Brentfo… Arsenal 2 0 H 1 0 H M Oliv… 8
## 2 14/08/20… Man Uni… Leeds 5 1 H 1 0 H P Tier… 16
## 3 14/08/20… Burnley Brighton 1 2 A 1 0 H D Coote 14
## 4 14/08/20… Chelsea Crystal… 3 0 H 2 0 H J Moss 13
## 5 14/08/20… Everton Southam… 3 1 H 0 1 A A Madl… 14
## 6 14/08/20… Leicest… Wolves 1 0 H 1 0 H C Paws… 9
## 7 14/08/20… Watford Aston V… 3 2 H 2 0 H M Dean 13
## 8 14/08/20… Norwich Liverpo… 0 3 A 0 1 A A Marr… 14
## 9 15/08/20… Newcast… West Ham 2 4 A 2 1 H M Atki… 17
## 10 15/08/20… Tottenh… Man City 1 0 H 0 0 D A Tayl… 13
## # ℹ 370 more rows
## # ℹ 11 more variables: AS <dbl>, HST <dbl>, AST <dbl>, HF <dbl>, AF <dbl>,
## # HC <dbl>, AC <dbl>, HY <dbl>, AY <dbl>, HR <dbl>, AR <dbl>
How many times did the home team go on to lose to the away team after being in the lead at halftime?
# ggpie(data = Prem,group_key = NULL, count(x = Prem))
# plot the bars with numeric labels
Prem %>%
count(HTR, FTR) %>%
filter(HTR == "H") %>%
ggplot(aes(FTR, n)) +
geom_col()+
geom_text(aes(label = n))
It seems to be that there has been 8 times the home team has failed to close out the game after winning the first half.