The package provides easy access to AFLW data from the AFL.com.au
website. This can be accessed via the normal
functions in the same way you would access Men’s data.
This vignette talks through the main data sources. To fully
understand how the
fetch_ functions work - please read the
Fetch Functions vignette.
Firstly, we can return the fixture for a season or particular round.
fetch_fixture(season = 2021, comp = "AFLW") %>% select(compSeason.name, round.name, home.team.name, away.team.name, venue.name)
We can get the lineup for a given set of matches in a particular round.
fetch_lineup(2021, round_number = 1, comp = "AFLW") %>% select(round.name, status, teamName, player.playerName.givenName, player.playerName.surname, teamStatus)
The match results, including the teams playing, venue information and
final scores are returned via
fetch_results(2020, round_number = 1, comp = "AFLW") %>% select( match.date, match.name, homeTeamScore.matchScore.totalScore, awayTeamScore.matchScore.totalScore)
We can also get the ladder at any point with
fetch_ladder(2020, round_number = 6, comp = "AFLW") %>% select(season, round_name, position, team.name, played, pointsFor, pointsAgainst)
Lastly - we have basic player stats. This will return player level statistics such as possessions, time on ground, fantasy points and a myriad of other statistics.
fetch_player_stats(2020, round_number = 1, comp = "AFLW") %>% select(player.player.player.givenName:clearances.totalClearances)
We can return player details such as data of birth and listed height and weight.
<- fetch_player_details(team = "Western Bulldogs", current = TRUE, comp = "AFLW", source = "AFL") details_aflw head(details_aflw)
We can also return the coaches votes for a particular season, team or round.
fetch_coaches_votes(season = 2021, round_number = 9, comp = "AFLW", team = "Western Bulldogs")
We have a legacy function to provide advanced AFLW stats. This is going to be deprecated in favour of a more robust solution but still works for now. The following code should show you how to use those functions. ### Match data
A good thing to check is that the cookie is working. Often this gets changed or moved and without it, the code won’t work.
<- get_afl_cookie() cookie print(cookie)
Note - if this is
NULL the rest of this Vignette won’t
show any outputs but the code will remain!
We can use the
fetch_results() function to retrieve
match data matches.
<- fetch_results(2020, round_number = 1, comp = "AFLW")match_data
Note that there will be warnings if a fixture is available but no match data has been added yet. If this is the case, make sure you don’t try to request detailed match stats for these match IDs.
get_aflw_detailed_data() can be used to return more
detailed data than the match data shown above. It takes a vector of
match IDs as an argument. For example, let’s say we want detailed stats
for the first 10 games in
match_data above. Then we would
<- head(match_data, 10) first10 <- first10$Match.Id first10_ids first10_ids
<- get_aflw_detailed_data(first10_ids) detailed glimpse(detailed)