fitzRoy v1.1.0

fitzRoy v1.1.0 is now on CRAN
fitzRoy
Author

James Day

Published

January 11, 2022

I’m excited to announce the official v1.1.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.

Player Details

Newly included are the player_details functions. These follow the same pattern as the main fetch_ family of functions, with some slight differences.

You can use fetch_player_details to return a list of player details for a given club and source. The source will determine exactly what details are returned. The default is the AFL.com.au website.

The AFL website will return AFLW or AFLM data, while other sources only include AFLM data.

aflw_players <- fetch_player_details(team = "Western Bulldogs", current = TRUE, comp = "AFLW", source = "AFL")

head(aflw_players)
# A tibble: 0 × 1
# … with 1 variable: data_accessed <date>

The list of details for AFL.com.au website is below.

glimpse(aflw_players)
Rows: 0
Columns: 1
$ data_accessed <date> 

The AFLTables.com source will return all players who have played for the specified team over time.

fetch_player_details("Hawthorn", source = "afltables")
# A tibble: 957 × 15
   Player   Team    Cap `#`   HT    WT    Games  Wins Draws Losses Goals Seasons
   <chr>    <chr> <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl>  <dbl> <dbl> <chr>  
 1 Paddy B… Hawt…     1 6     183cm "82k…    31     6     1     24    13 1925-1…
 2 Dave El… Hawt…     2 23    175cm "70k…     3     0     0      3     5 1925   
 3 Fred Fi… Hawt…     3 11    183cm "84k…    37     6     1     30    10 1925-1…
 4 Jack Gi… Hawt…     4 14    171cm ""       40     7     0     33     9 1925-1…
 5 Gil Hen… Hawt…     5 17    185cm "84k…    17     2     0     15     9 1925, …
 6 Jim Jac… Hawt…     6 1     174cm "73k…    22     4     1     17     1 1925-1…
 7 Jim McC… Hawt…     7 8     175cm "73k…    46     6     1     39     7 1925-1…
 8 Stan Mc… Hawt…     8 3     173cm "75k…    17     3     0     14    NA 1925   
 9 Cyril N… Hawt…     9 2     180cm "70k…    18     2     1     15     1 1925-1…
10 Bert Of… Hawt…    10 21    182cm "80k…    12     2     0     10     6 1925   
# … with 947 more rows, and 3 more variables: Debut <chr>, Last <chr>,
#   date_accessed <date>

The Footywire.com source allows you to specify just the current list of players, which is fairly quick, or all players over time which can be a little slow.

fetch_player_details("Richmond", source = "footywire", current = TRUE)
# A tibble: 43 × 11
   No    surname  first_name Games Age      Date …¹ Height Weight Origin Posit…²
   <chr> <chr>    <chr>      <chr> <chr>    <chr>   <chr>  <chr>  <chr>  <chr>  
 1 7     Baker    Liam       87    25yr     27 Jan… 173cm  72kg   Subia… Defend…
 2 21    Balta    Noah       62    23yr 4m… 23 Oct… 194cm  102kg  Calde… Defend…
 3 41    Banks    Sam        0     19yr 10… 2 Apr … 186cm  71kg   Tasma… Defend…
 4 43    Bauer    Jacob      0     20yr 6m… 6 Aug … 191cm  80kg   North… Forward
 5 29    Bolton   Shai       90    24yr 2m… 8 Dec … 175cm  77kg   South… Midfie…
 6 37    Bradtke  Kaelan     0     21yr 9m… 21 May… 195cm  95kg   Corow… Defend…
 7 35    Broad    Nathan     107   29yr 10… 15 Apr… 192cm  89kg   Swan … Defend…
 8 30    Brown    Tom        0     19yr 6m… 30 Jul… 186cm  77kg   Murra… Defend…
 9 44    Campbell Seth       0     18yr 1m… 29 Dec… 182cm  73kg   Tasma… Forward
10 11    Castagna Jason      134   26yr 7m… 12 Jul… 182cm  82kg   North… Forward
# … with 33 more rows, 1 more variable: Position_2 <chr>, and abbreviated
#   variable names ¹​`Date of Birth`, ²​Position_1

One challenge is that each source accepts different values for the team argument. There is a helper function that will return an error if the wrong team is supplied and provide a list of acceptable values for that specific source.

You can read full details on the Player Details Vignette

fetch_player_details("Greater Western Sydney", source = "afltables")
Error in `team_check_afltables()`:
! Greater Western Sydney is not a valid input for afltables teams.
Should be one of Adelaide, Brisbane Lions, Brisbane Bears, Carlton, Collingwood, Essendon, Fitzroy, Fremantle, GWS, Geelong, Gold Coast, Hawthorn, Melbourne, North Melbourne, Kangaroos, Port Adelaide, Richmond, St Kilda, Sydney, South Melbourne, West Coast, University, Western Bulldogs, Footscray 

Coaches votes

A new set of functions will return coaches votes.

coaches <- fetch_coaches_votes(season = 2021, round_number = 1, team = "Hawthorn")
coaches
     Season Round Home.Team Away.Team            Player.Name Coaches.Votes
1.27   2021     1  Essendon  Hawthorn     Tom Mitchell (HAW)            10
1.28   2021     1  Essendon  Hawthorn   Jaeger O'Meara (HAW)             8
1.29   2021     1  Essendon  Hawthorn     Zach Merrett (ESS)             5
1.30   2021     1  Essendon  Hawthorn   Andrew McGrath (ESS)             4
1.31   2021     1  Essendon  Hawthorn         Will Day (HAW)             2
1.32   2021     1  Essendon  Hawthorn Changkuoth Jiath (HAW)             1

An associated function will also calculate possible ways in which the cochaes may have voted.

calculate_coaches_vote_possibilities(coaches, "Coach View")
[[1]]
  Votes                   C1                     C2
1     5   Tom Mitchell (HAW)     Tom Mitchell (HAW)
2     4 Jaeger O'Meara (HAW)   Jaeger O'Meara (HAW)
3     3   Zach Merrett (ESS)   Andrew McGrath (ESS)
4     2       Will Day (HAW)     Zach Merrett (ESS)
5     1 Andrew McGrath (ESS) Changkuoth Jiath (HAW)

You can read about these functions fully at the new Vignette

Other changes

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