jimmyday12 / fitzRoy

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

vfl box scores and team line ups #173

Closed jt026 closed 2 years ago

jt026 commented 2 years ago

could vfl box scores and selected line ups be added to the package. https://www.afl.com.au/vfl/matches/4247#player-stats https://www.afl.com.au/vfl/matches/4247#line-ups

jimmyday12 commented 2 years ago

Hi @jt026 I've just made a commit that I think allows this. I haven't tested it properly but you should be able to just use comp = "VFL" in any of the fetch_ functions, providing you use source = "AFL".

e.g.

fetch_fixture(2022, source = "AFL", comp = "VFL")
fetch_player_stats(2022, round = 1, source = "AFL", comp = "VFL")
fetch_fixture(2022, source = "AFL", comp = "VFL")

Note this should also work for all other comps that are available on the AFL api

Those last two are NAB League and are technically competitions that the API accepts but as far as I can tell the API doesn't return any data for them. I haven't tested all functions so there may be some data somewhere.

olivergigacz commented 2 years ago

Hi Jimmy,

Thanks for setting this up, please ignore my other request as I had failed to see this thread before posting.

The VFL and VFLW seem to be working fine, except that some clubs are showing as NA in the club.name sections...

VFL Aspley Carlton Frankston Northern Bullants Port Melbourne Sandringham Southport Werribee Williamstown

Also Footscray is listed as Western Bulldogs , Box Hill is listed as Hawthorn, Casey is listed as Melbourne and Sandringham is listed as St Kilda.

VFLW Darebin Williamstown

Also Port Melbourne is listed as Richmond and Southern Saints is listed as St Kilda

The WAFL however is having some issues and it also seems to be related to the club.name..

<error/rlang_error_data_pronoun_not_found>
Error in `dplyr::select()`:
! Column `home.team.club.name` not found in `.data`.
---
Backtrace:
  1. fitzRoy::fetch_player_stats(...)
 28. rlang:::abort_data_pronoun(x, call = y)
Run `rlang::last_trace()` to see the full context.

Cheers,

Oliver

jimmyday12 commented 2 years ago

I think this latest commit will have fixed that specific issue https://github.com/jimmyday12/fitzRoy/commit/c4145edf74b696ac5c724a7b3a572ec480d0c747

I do need to do a fair bit of refactoring overall to get this to work nicely. A lot of the logic was based off assuming things were in the AFL, so some functions that checked names etc are breaking. Hopefully get a chance to do that over the coming weeks