Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent home and away teams in drawn finals using get_afltables_stats() #116

Closed
insightlane opened this issue May 8, 2020 · 1 comment
Closed

Comments

@insightlane
Copy link

@insightlane insightlane commented May 8, 2020

In get_afltables_stats() for drawn finals, there are inconsistent Home.team and Away.team fields which seem to relate to the player-level Playing.for field (as per every other match). This is inconsistent with all other games where the Home.team and Away.team are static for each match. Seems to be okay for all other spot-checked drawn matches.


Brief description of the problem

afltables_data <- get_afltables_stats(start_date = "1897-05-07", end_date = Sys.Date())

afltables_data %>%
  filter(Season == 2010 & Round == "GF" & Home.score == Away.score) %>%
  distinct(Season, Round, Date, Venue, Home.team, Home.score, Away.team, Away.score, Playing.for) 

# A tibble: 2 x 9
  Season Round Date       Venue  Home.team   Home.score Away.team   Away.score Playing.for
   <dbl> <chr> <date>     <chr>  <chr>            <int> <chr>            <int> <chr>      
1   2010 GF    2010-09-25 M.C.G. Collingwood         68 St Kilda            68 Collingwood
2   2010 GF    2010-09-25 M.C.G. St Kilda            68 Collingwood         68 St Kilda   

afltables_data %>%
  distinct(Season, Round, Date, Venue, Home.team, Home.score, Away.team, Away.score) %>%
  filter(Home.score == Away.score) %>%
  group_by(Season, Round, Date, Venue) %>%
  mutate(count = n()) %>%
  filter(count > 1) %>%
  arrange(Date)

# A tibble: 16 x 9
# Groups:   Season, Round, Date, Venue [8]
   Season Round Date       Venue         Home.team       Home.score Away.team       Away.score count
    <dbl> <chr> <date>     <chr>         <chr>                <int> <chr>                <int> <int>
 1   1928 SF    1928-09-15 M.C.G.        Collingwood             62 Melbourne               62     2
 2   1928 SF    1928-09-15 M.C.G.        Melbourne               62 Collingwood             62     2
 3   1946 SF    1946-09-14 M.C.G.        Collingwood            100 Essendon               100     2
 4   1946 SF    1946-09-14 M.C.G.        Essendon               100 Collingwood            100     2
 5   1948 GF    1948-10-02 M.C.G.        Essendon                69 Melbourne               69     2
 6   1948 GF    1948-10-02 M.C.G.        Melbourne               69 Essendon                69     2
 7   1962 PF    1962-09-15 M.C.G.        Carlton                 85 Geelong                 85     2
 8   1962 PF    1962-09-15 M.C.G.        Geelong                 85 Carlton                 85     2
 9   1972 SF    1972-09-16 Waverley Park Carlton                 61 Richmond                61     2
10   1972 SF    1972-09-16 Waverley Park Richmond                61 Carlton                 61     2
11   1977 GF    1977-09-24 M.C.G.        Collingwood             76 North Melbourne         76     2
12   1977 GF    1977-09-24 M.C.G.        North Melbourne         76 Collingwood             76     2
13   1990 QF    1990-09-08 Waverley Park Collingwood             90 West Coast              90     2
14   1990 QF    1990-09-08 Waverley Park West Coast              90 Collingwood             90     2
15   2010 GF    2010-09-25 M.C.G.        Collingwood             68 St Kilda                68     2
16   2010 GF    2010-09-25 M.C.G.        St Kilda                68 Collingwood             68     2
@jimmyday12
Copy link
Owner

@jimmyday12 jimmyday12 commented May 22, 2020

I think this should be fixed on the development version on github @insightlane. Would love any feedback to confirm but at least the above test case should be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.