fitzRoy v1.1.0

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: 6 × 15
##   firstName surname     id team       season jumperNumber position    providerId
##   <chr>     <chr>    <int> <chr>       <dbl>        <int> <chr>       <chr>     
## 1 Hannah    Scott     1502 Western B…   2022           22 MEDIUM_DEF… CD_I10016…
## 2 Ashleigh  Guest     1630 Western B…   2022           19 MEDIUM_DEF… CD_I10044…
## 3 Brooke    Lochland  1447 Western B…   2022            1 MEDIUM_FOR… CD_I10044…
## 4 Ellyse    Gamble    1445 Western B…   2022           14 RUCK        CD_I10053…
## 5 Bailey    Hunt      1649 Western B…   2022           21 MEDIUM_DEF… CD_I10070…
## 6 Kirsten   McLeod    1668 Western B…   2022            6 MEDIUM_FOR… CD_I10070…
## # … with 7 more variables: dateOfBirth <chr>, heightInCm <int>,
## #   weightInKg <int>, recruitedFrom <chr>, debutYear <chr>, draftType <chr>,
## #   data_accessed <date>

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

glimpse(aflw_players)
## Rows: 31
## Columns: 15
## $ firstName     <chr> "Hannah", "Ashleigh", "Brooke", "Ellyse", "Bailey", "Kir…
## $ surname       <chr> "Scott", "Guest", "Lochland", "Gamble", "Hunt", "McLeod"…
## $ id            <int> 1502, 1630, 1447, 1445, 1649, 1668, 2024, 2096, 2171, 21…
## $ team          <chr> "Western Bulldogs", "Western Bulldogs", "Western Bulldog…
## $ season        <dbl> 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 20…
## $ jumperNumber  <int> 22, 19, 1, 14, 21, 6, 9, 5, 25, 3, 11, 16, 8, 13, 33, 12…
## $ position      <chr> "MEDIUM_DEFENDER", "MEDIUM_DEFENDER", "MEDIUM_FORWARD", …
## $ providerId    <chr> "CD_I1001689", "CD_I1004402", "CD_I1004408", "CD_I100537…
## $ dateOfBirth   <chr> "1990-03-10", "1990-04-10", "1991-05-03", "1997-09-16", …
## $ heightInCm    <int> 168, 169, 158, 180, 171, 161, 176, 175, 176, 175, 175, 1…
## $ weightInKg    <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
## $ recruitedFrom <chr> "Eastern Devils (VFLW)", "Western Spurs (VFLW)/GWS/Melbo…
## $ debutYear     <chr> "2017", "2017", "2017", "2017", "2017", "2017", "2019", …
## $ draftType     <chr> "other", "other", "other", "other", "other", "other", "o…
## $ data_accessed <date> 2022-01-11, 2022-01-11, 2022-01-11, 2022-01-11, 2022-01…

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: 948 × 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 … Hawth…     1 6     183cm "82k…    31     6     1     24    13 1925-1…
##  2 Dave E… Hawth…     2 23    175cm "70k…     3     0     0      3     5 1925   
##  3 Fred F… Hawth…     3 11    183cm "84k…    37     6     1     30    10 1925-1…
##  4 Jack G… Hawth…     4 14    171cm ""       40     7     0     33     9 1925-1…
##  5 Gil He… Hawth…     5 17    185cm "84k…    17     2     0     15     9 1925, …
##  6 Jim Ja… Hawth…     6 1     174cm "73k…    22     4     1     17     1 1925-1…
##  7 Jim Mc… Hawth…     7 8     175cm "73k…    46     6     1     39     7 1925-1…
##  8 Stan M… Hawth…     8 3     173cm "75k…    17     3     0     14    NA 1925   
##  9 Cyril … Hawth…     9 2     180cm "70k…    18     2     1     15     1 1925-1…
## 10 Bert O… Hawth…    10 21    182cm "80k…    12     2     0     10     6 1925   
## # … with 938 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 of Birth` Height Weight Origin  
##    <chr> <chr>    <chr>      <chr> <chr>  <chr>           <chr>  <chr>  <chr>   
##  1 16    Aarts    Jake       34    27yr … 8 Dec 1994      177cm  76kg   Richmon…
##  2 7     Baker    Liam       64    23yr … 27 Jan 1998     173cm  72kg   Subiaco 
##  3 21    Balta    Noah       44    22yr … 23 Oct 1999     194cm  102kg  Calder …
##  4 41    Banks    Sam        0     18yr … 2 Apr 2003      186cm  71kg   Tasmani…
##  5 29    Bolton   Shai       67    23yr … 8 Dec 1998      175cm  77kg   South F…
##  6 35    Broad    Nathan     84    28yr … 15 Apr 1993     192cm  89kg   Swan Di…
##  7 30    Brown    Tom        0     18yr … 30 Jul 2003     186cm  77kg   Murray …
##  8 22    Caddy    Josh       171   29yr … 28 Sep 1992     186cm  87kg   Norther…
##  9 11    Castagna Jason      117   25yr … 12 Jul 1996     182cm  82kg   Norther…
## 10 42    Clarke   Judson     0     18yr … 17 Oct 2003     179cm  69kg   Dandeno…
## # … with 33 more rows, and 2 more variables: Position_1 <chr>, Position_2 <chr>

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: 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

comments powered by Disqus