Functions have been added to fitzRoy to plot and analyse AFL score worms
plot_score_worm
- Plots the score difference between
two teams throughout a given match.plot_score_worm_totals
- Plots the total scores of both
teams throughout a given match.fetch_score_worm_data
- Returns score data used to plot
score worms for a given matchThe plot_score_worm
, plot_score_worm
, and
plot_score_worm
functions accepts the
argumentmatch_id
to fetch the plot/data for a given
match.
match_id
- the Champion Data match_id of the form
CD_MSSSS014RRMM where SSSS is the Season, RR is the Round and MM is the
Match. e.g. ‘CD_M20240142004’The following are some examples of ways to plot and scrape the score worm data.
Fist we can plot the score worm for the 2024 round 20 game between Fremantle and West Coast.
plot_score_worm('CD_M20240142004')
We can also plot the total scores of each team throughout the game.
plot_score_worm_totals('CD_M20240142004')
We can also just return the data for the fixture that can be used to construct these plots or for other score analysis.
fetch_score_worm_data('CD_M20240142004')
We can return multiple games worth of data by passing in a vector of match_ids.
fetch_score_worm_data(c('CD_M20240142101','CD_M20240142102','CD_M20240142103'))