jimmyday12 / fitzRoy

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

Duplicate date/venue combination breaks get_footywire_betting_odds #123

Closed cfranklin11 closed 4 years ago

cfranklin11 commented 4 years ago

Calling get_footywire_betting_odds for the 2020 season raises an error, because the use of pivot_wider assumes that two matches are never played at the same venue on the same day. However, the upcoming round has two matches at Metricon stadium, which means pivoting groups multiple teams together into the team columns, which breaks downstream type checks (the specific error is "must be a character vector, not a list" when we call case_when inside replace_teams.

I have a fix in #122

Adding a temporary Match.ID column guarantees unique match values for pivoting to one match per row. Since we just need the column for this purpose, I dropped it after pivoting, but not sure if there's any value in keeping it.

I also updated the tests to include the 2020 season for betting data to make sure we catch any regressions.

cfranklin11 commented 4 years ago

Forgot to close this when the PR was merged