fitzRoy v1.2.0

I’m excited to announce the official v1.2.0 release of fitzRoy has landed on CRAN!

This release includes a few new features and some improvements to bugs that had been reported. Read on to find out about them.

Breaking Change - default argument behaviour

There was some inconsistencies in how fetch_player_stats_afltables handled NULL dates. For most functions, this would return the current season. However, for this particular function it was returning all data which was confusing. This has been changed to be consistent with other functions but will break existing code that relied on the incorrect logic so you should update your code where needed.

player_stats <- fetch_player_details()

head(player_stats)
## # A tibble: 6 × 17
##   firstName surname      id team  season jumpe…¹ posit…² provi…³ dateO…⁴ draft…⁵
##   <chr>     <chr>     <int> <chr>  <dbl>   <int> <chr>   <chr>   <chr>   <chr>  
## 1 Tom       Doedee      813 Adel…   2022      39 KEY_DE… CD_I10… 1997-0… 2015   
## 2 Lachlan   Murphy     1723 Adel…   2022       4 MEDIUM… CD_I10… 1998-1… 2017   
## 3 Mitchell  Hinge      1292 Adel…   2022      20 MEDIUM… CD_I10… 1998-0… 2020   
## 4 Jordon    Butts      1824 Adel…   2022      41 KEY_DE… CD_I10… 1999-1… 2018   
## 5 Elliott   Himmelbe…  1357 Adel…   2022      34 KEY_FO… CD_I10… 1998-0… 2016   
## 6 Lachlan   Sholl      1761 Adel…   2022      38 MIDFIE… CD_I10… 2000-0… 2018   
## # … with 7 more variables: heightInCm <int>, weightInKg <int>,
## #   recruitedFrom <chr>, debutYear <chr>, draftType <chr>, draftPosition <chr>,
## #   data_accessed <date>, and abbreviated variable names ¹​jumperNumber,
## #   ²​position, ³​providerId, ⁴​dateOfBirth, ⁵​draftYear
## # ℹ Use `colnames()` to see all variable names

Second 2022 AFLW Season is now returned

Having two seasons in the same year for the AFLW competition was causing issues with all fetch_* functions. Specifically, the functions were only returning data for the first of the two seasons.

A change has been made that now returns both seasons when setting the season argument to “2022”. This has been determined as the simplest, least disruptive option for now but may be reviewed in the future. You can use various fields in the returned data to filter out the season you are interested in.

aflw_fixture <- fetch_fixture_afl(2022, round_number = 1, comp = "AFLW")

aflw_fixture %>%
  dplyr::select(compSeason.id, compSeason.shortName,
                round.id, round.name, 
                home.team.name, away.team.name, venue.name)
## # A tibble: 16 × 7
##    compSeason.id compSeason.shortName round.id round.n…¹ home.…² away.…³ venue…⁴
##            <int> <chr>                   <int> <chr>     <chr>   <chr>   <chr>  
##  1            41 AFLW Season 6             578 Round 1   St Kil… Richmo… Skybus…
##  2            41 AFLW Season 6             578 Round 1   Kangar… Geelon… Arden …
##  3            41 AFLW Season 6             578 Round 1   Wester… Melbou… Victor…
##  4            41 AFLW Season 6             578 Round 1   Freman… West C… Freman…
##  5            41 AFLW Season 6             578 Round 1   Adelai… Brisba… Flinde…
##  6            41 AFLW Season 6             578 Round 1   Carlton Collin… Ikon P…
##  7            41 AFLW Season 6             578 Round 1   Gold C… GWS Gi… Great …
##  8            51 AFLW Season 7             728 Round 1   Carlton Collin… Ikon P…
##  9            51 AFLW Season 7             728 Round 1   Adelai… Melbou… ACH Gr…
## 10            51 AFLW Season 7             728 Round 1   Kangar… Gold C… Blunds…
## 11            51 AFLW Season 7             728 Round 1   West C… Port A… Minera…
## 12            51 AFLW Season 7             728 Round 1   Sydney… St Kil… North …
## 13            51 AFLW Season 7             728 Round 1   Essend… Hawtho… Marvel…
## 14            51 AFLW Season 7             728 Round 1   Wester… GWS Gi… Ikon P…
## 15            51 AFLW Season 7             728 Round 1   Brisba… Freman… Gabba  
## 16            51 AFLW Season 7             728 Round 1   Geelon… Richmo… GMHBA …
## # … with abbreviated variable names ¹​round.name, ²​home.team.name,
## #   ³​away.team.name, ⁴​venue.name

Non-AFL data

An experimental feature as of version 1.2.0 is returning non-AFL related data. This only works for the source AFL but there are other comps that are available. These comps do not have as much data as the AFLM and AFLW comps but some functions will work.

Available comps include

  • “VFL”
  • “VFLW”
  • “WAFL”
  • “U18B”
  • “U18G”

You will have to experiment with which dates, rounds and comps work for various functions but the API should at least return a NULL value or warning if no data exists. You will also note that not all data exists, particularly advanced statistics. Please note this feature is experimental and will be improved over time.

fetch_fixture(2022, source = "AFL", comp = "VFL")
## # A tibble: 198 × 53
##       id provid…¹ utcSt…² status compS…³ compS…⁴ compS…⁵ compS…⁶ compS…⁷ round…⁸
##    <int> <chr>    <chr>   <chr>    <int> <chr>   <chr>   <chr>     <int>   <int>
##  1  4348 CD_M202… 2022-0… CONCL…      47 CD_S20… 2022 V… 2022 V…      26     637
##  2  4347 CD_M202… 2022-0… CONCL…      47 CD_S20… 2022 V… 2022 V…      26     637
##  3  4350 CD_M202… 2022-0… CONCL…      47 CD_S20… 2022 V… 2022 V…      26     637
##  4  4349 CD_M202… 2022-0… CONCL…      47 CD_S20… 2022 V… 2022 V…      26     637
##  5  4162 CD_M202… 2022-0… CONCL…      47 CD_S20… 2022 V… 2022 V…      26     637
##  6  4164 CD_M202… 2022-0… CONCL…      47 CD_S20… 2022 V… 2022 V…      26     637
##  7  4163 CD_M202… 2022-0… CONCL…      47 CD_S20… 2022 V… 2022 V…      26     637
##  8  4167 CD_M202… 2022-0… CONCL…      47 CD_S20… 2022 V… 2022 V…      26     637
##  9  4165 CD_M202… 2022-0… CONCL…      47 CD_S20… 2022 V… 2022 V…      26     637
## 10  4168 CD_M202… 2022-0… CONCL…      47 CD_S20… 2022 V… 2022 V…      26     637
## # … with 188 more rows, 43 more variables: round.providerId <chr>,
## #   round.abbreviation <chr>, round.name <chr>, round.roundNumber <int>,
## #   round.byes <list>, home.team.id <int>, home.team.providerId <chr>,
## #   home.team.name <chr>, home.team.abbreviation <chr>,
## #   home.team.nickname <chr>, home.team.teamType <chr>,
## #   home.team.club.id <int>, home.team.club.providerId <chr>,
## #   home.team.club.name <chr>, home.team.club.abbreviation <chr>, …
## # ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names
fetch_player_stats(2022, round = 1, source = "AFL", comp = "VFLW")
## # A tibble: 252 × 70
##    providerId     utcSt…¹ status compS…² round…³ round…⁴ venue…⁵ home.…⁶ home.…⁷
##    <chr>          <chr>   <chr>  <chr>   <chr>     <int> <chr>   <chr>   <chr>  
##  1 CD_M202246401… 2022-0… CONCL… 2022 V… Round 1       1 Casey … Casey … Melbou…
##  2 CD_M202246401… 2022-0… CONCL… 2022 V… Round 1       1 Casey … Casey … Melbou…
##  3 CD_M202246401… 2022-0… CONCL… 2022 V… Round 1       1 Casey … Casey … Melbou…
##  4 CD_M202246401… 2022-0… CONCL… 2022 V… Round 1       1 Casey … Casey … Melbou…
##  5 CD_M202246401… 2022-0… CONCL… 2022 V… Round 1       1 Casey … Casey … Melbou…
##  6 CD_M202246401… 2022-0… CONCL… 2022 V… Round 1       1 Casey … Casey … Melbou…
##  7 CD_M202246401… 2022-0… CONCL… 2022 V… Round 1       1 Casey … Casey … Melbou…
##  8 CD_M202246401… 2022-0… CONCL… 2022 V… Round 1       1 Casey … Casey … Melbou…
##  9 CD_M202246401… 2022-0… CONCL… 2022 V… Round 1       1 Casey … Casey … Melbou…
## 10 CD_M202246401… 2022-0… CONCL… 2022 V… Round 1       1 Casey … Casey … Melbou…
## # … with 242 more rows, 61 more variables: away.team.name <chr>,
## #   away.team.club.name <chr>, player.jumperNumber <int>,
## #   player.photoURL <chr>, player.player.position <chr>,
## #   player.player.player.playerId <chr>, player.player.player.captain <lgl>,
## #   player.player.player.playerJumperNumber <int>,
## #   player.player.player.givenName <chr>, player.player.player.surname <chr>,
## #   teamId <chr>, gamesPlayed <lgl>, timeOnGroundPercentage <lgl>, …
## # ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names
fetch_fixture(2022, source = "AFL", comp = "WAFL")
## # A tibble: 96 × 53
##       id provid…¹ utcSt…² status compS…³ compS…⁴ compS…⁵ compS…⁶ compS…⁷ round…⁸
##    <int> <chr>    <chr>   <chr>    <int> <chr>   <chr>   <chr>     <int>   <int>
##  1  4458 CD_M202… 2022-0… CONCL…      49 CD_S20… 2022 W… 2022 W…      24     681
##  2  4457 CD_M202… 2022-0… CONCL…      49 CD_S20… 2022 W… 2022 W…      24     681
##  3  4459 CD_M202… 2022-0… CONCL…      49 CD_S20… 2022 W… 2022 W…      24     681
##  4  4460 CD_M202… 2022-0… CONCL…      49 CD_S20… 2022 W… 2022 W…      24     681
##  5  4461 CD_M202… 2022-0… CONCL…      49 CD_S20… 2022 W… 2022 W…      24     681
##  6  4462 CD_M202… 2022-0… CONCL…      49 CD_S20… 2022 W… 2022 W…      24     682
##  7  4463 CD_M202… 2022-0… CONCL…      49 CD_S20… 2022 W… 2022 W…      24     682
##  8  4464 CD_M202… 2022-0… CONCL…      49 CD_S20… 2022 W… 2022 W…      24     682
##  9  4465 CD_M202… 2022-0… CONCL…      49 CD_S20… 2022 W… 2022 W…      24     682
## 10  4466 CD_M202… 2022-0… CONCL…      49 CD_S20… 2022 W… 2022 W…      24     682
## # … with 86 more rows, 43 more variables: round.providerId <chr>,
## #   round.abbreviation <chr>, round.name <chr>, round.roundNumber <int>,
## #   round.byes <list>, home.team.id <int>, home.team.providerId <chr>,
## #   home.team.name <chr>, home.team.abbreviation <chr>,
## #   home.team.nickname <chr>, home.team.teamType <chr>,
## #   home.team.club.id <int>, home.team.club.providerId <chr>,
## #   home.team.club.name <chr>, home.team.club.abbreviation <chr>, …
## # ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names

Other changes

You can read about the rest of the bugs in the changelog

comments powered by Disqus