jimmyday12 / fitzRoy

A set of functions to easily access AFL data
https://jimmyday12.github.io/fitzRoy
Other
126 stars 27 forks source link

Incorrect umpire names in AFL Tables data #170

Closed neilfws closed 1 month ago

neilfws commented 2 years ago

There is an issue with some of the umpire names in the output from get_afltables_stats().

See the value column in the output below, which should contain an umpire name. The affected values contain digits and other text.

library(fitzRoy)
library(dplyr)

afldata <- get_afltables_stats()

afldata %>% 
  distinct(Date, Local.start.time, Venue, Home.team, Away.team, Umpire.1, Umpire.2, Umpire.3, Umpire.4) %>% 
  pivot_longer(cols = starts_with("Ump")) %>% 
  filter(value != "") %>% 
  mutate(value = trimws(value)) %>%
  filter(str_detect(value, "\\d"))

Result:

# A tibble: 17 × 7
   Date       Local.start.time Venue             Home.team              Away.team              name     value                      
   <date>                <int> <chr>             <chr>                  <chr>                  <chr>    <chr>                      
 1 1907-06-15              300 Princes Park      Carlton                Essendon               Umpire.1 236 v Sydney - R17         
 2 1907-06-15              300 Princes Park      Carlton                Essendon               Umpire.2 1987                       
 3 2017-04-01             1635 Sydney Showground Greater Western Sydney Gold Coast             Umpire.1 108 v Gold Coast - R12     
 4 2017-04-01             1635 Sydney Showground Greater Western Sydney Gold Coast             Umpire.2 2018                       
 5 2019-08-09             1950 Manuka Oval       Greater Western Sydney Hawthorn               Umpire.1 25 v Richmond - Grand Final
 6 2019-08-09             1950 Manuka Oval       Greater Western Sydney Hawthorn               Umpire.2 2019                       
 7 2020-06-21             1505 Carrara           Gold Coast             Adelaide               Umpire.1 28 v North Melbourne - R14 
 8 2020-06-21             1505 Carrara           Gold Coast             Adelaide               Umpire.2 2020                       
 9 2022-03-24             1920 Docklands         Western Bulldogs       Carlton                Umpire.1 WB 19-13                   
10 2022-03-25             1950 S.C.G.            Sydney                 Geelong                Umpire.1 GE 16-13                   
11 2022-03-26             1345 M.C.G.            Collingwood            Adelaide               Umpire.1 AD 10-9                    
12 2022-03-26             1635 Docklands         Essendon               Brisbane Lions         Umpire.1 14-14                      
13 2022-03-26             1900 Carrara           Gold Coast             Melbourne              Umpire.1 GC 14-5                    
14 2022-03-26             1910 Adelaide Oval     Port Adelaide          Hawthorn               Umpire.1 HW 32-4                    
15 2022-03-27             1310 Docklands         North Melbourne        West Coast             Umpire.1 WC 17-15                   
16 2022-03-27             1520 M.C.G.            Richmond               Greater Western Sydney Umpire.1 RI 34-22                   
17 2022-03-27             1520 Perth Stadium     Fremantle              St Kilda               Umpire.1 FR 15-7

I also just noticed another form of incorrect value for Umpire.1:

2017-04-09             1640 Carrara       Gold Coast Hawthorn  Umpire.1 Current holder
jimmyday12 commented 1 month ago

https://github.com/jimmyday12/fitzRoy/pull/223