Title: | Easily Scrape and Process AFL Data |
---|---|
Description: | An easy package for scraping and processing Australia Rules Football (AFL) data. 'fitzRoy' provides a range of functions for accessing publicly available data from 'AFL Tables' <https://afltables.com/afl/afl_index.html>, 'Footy Wire' <https://www.footywire.com> and 'The Squiggle' <https://squiggle.com.au>. Further functions allow for easy processing, cleaning and transformation of this data into formats that can be used for analysis. |
Authors: | James Day [cre, aut], Robert Nguyen [aut], Matthew Erbs [ctb], Oscar Lane [aut], Jason Zivkovic [ctb], Jacob Holden [ctb] |
Maintainer: | James Day <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.5.0.9000 |
Built: | 2024-11-04 03:18:53 UTC |
Source: | https://github.com/jimmyday12/fitzroy |
calculate_coaches_vote_possibilities
returns all possible breakdowns of coaches votes between two coaches,
given a breakdown of AFLCA coaches votes
calculate_coaches_vote_possibilities(df, output_type)
calculate_coaches_vote_possibilities(df, output_type)
df |
Requires the following column names: Player.Name, Coaches.Votes. These can be returned from the
function |
output_type |
One of "Coach View", "Player View". Defaults to "Coach View". |
Data frame For output_type "Coach View" - A list of data frames with columns: Votes, C1, C2 For output_type "Player View" - A list of data frames with columns: Player, V1, V2
## Not run: # Return coaches votes for a particular match, then find the possibilities df <- fetch_coaches_votes(comp = "AFLM", season = 2021, round = 24, team = "Western Bulldogs") calculate_coaches_vote_possibilities(df, "Coach View") df <- fetch_coaches_votes(comp = "AFLW", season = 2021, round = 9, team = "Western Bulldogs") calculate_coaches_vote_possibilities(df, "Player View") # Create a manual data frame to calculate possibilities df <- data.frame( Player.Name = c( "Tom Liberatore", "Jack Macrae", "Marcus Bontempelli", "Cody Weightman", "Darcy Parish", "Aaron Naughton", "Jordan Ridley" ), Coaches.Votes = c(7, 6, 5, 5, 4, 2, 1) ) calculate_coaches_vote_possibilities(df, "Player View") ## End(Not run)
## Not run: # Return coaches votes for a particular match, then find the possibilities df <- fetch_coaches_votes(comp = "AFLM", season = 2021, round = 24, team = "Western Bulldogs") calculate_coaches_vote_possibilities(df, "Coach View") df <- fetch_coaches_votes(comp = "AFLW", season = 2021, round = 9, team = "Western Bulldogs") calculate_coaches_vote_possibilities(df, "Player View") # Create a manual data frame to calculate possibilities df <- data.frame( Player.Name = c( "Tom Liberatore", "Jack Macrae", "Marcus Bontempelli", "Cody Weightman", "Darcy Parish", "Aaron Naughton", "Jordan Ridley" ), Coaches.Votes = c(7, 6, 5, 5, 4, 2, 1) ) calculate_coaches_vote_possibilities(df, "Player View") ## End(Not run)
fetch_betting_odds_footywire
returns a data frame containing betting odds and basic match info for Men's AFL matches.
fetch_betting_odds_footywire( start_season = "2010", end_season = lubridate::year(Sys.Date()) )
fetch_betting_odds_footywire( start_season = "2010", end_season = lubridate::year(Sys.Date()) )
start_season |
First season to return, in yyyy format. Earliest season with data available is 2010. |
end_season |
Last season to return, in yyyy format |
The data frame contains the home and away team as well as venue.
Returns a data frame containing betting odds and basic match info
## Not run: fetch_betting_odds_footywire(2012, 2018) ## End(Not run)
## Not run: fetch_betting_odds_footywire(2012, 2018) ## End(Not run)
fetch_coaches_votes
returns all coaches votes for input season/s, round/s, and/or team's matches.
The function calls a core scrape_coaches_votes
function which scrapes the AFLCA website for coaches votes
for a particular season, round and competition.
fetch_coaches_votes( season = NULL, round_number = NULL, comp = "AFLM", team = NULL )
fetch_coaches_votes( season = NULL, round_number = NULL, comp = "AFLM", team = NULL )
season |
Season in YYYY format. This can be an array of seasons. Defaults to null in which case the
season that matches |
round_number |
Round number. For finals this is the number of H&A rounds plus the Finals week. Defaults to null in which case all rounds are used. |
comp |
One of "AFLM" (default) or "AFLW" |
team |
Team or teams whose matches should be retrieved. Defaults to null in which case all teams are used. |
A data frame with columns: Season, Round, Finals, Home.Team, Away.Team, Player.Name, Coaches.Votes
## Not run: # Return all coaches votes across all seasons fetch_coaches_votes(season = 2007:2021, comp = "AFLM") fetch_coaches_votes(season = 2018:2021, comp = "AFLW") # Return all coaches votes for a particular round fetch_coaches_votes(season = 2021, round_number = 24, comp = "AFLM") fetch_coaches_votes(season = 2021, round_number = 9, comp = "AFLW") # Return all coaches votes for a particular team fetch_coaches_votes(season = 2021, comp = "AFLM", team = "Western Bulldogs") fetch_coaches_votes(season = 2021, comp = "AFLW", team = "Western Bulldogs") # Return all coaches votes for a particular match fetch_coaches_votes(season = 2021, round_number = 24, comp = "AFLM", team = "Western Bulldogs") fetch_coaches_votes(season = 2021, round_number = 9, comp = "AFLW", team = "Western Bulldogs") ## End(Not run)
## Not run: # Return all coaches votes across all seasons fetch_coaches_votes(season = 2007:2021, comp = "AFLM") fetch_coaches_votes(season = 2018:2021, comp = "AFLW") # Return all coaches votes for a particular round fetch_coaches_votes(season = 2021, round_number = 24, comp = "AFLM") fetch_coaches_votes(season = 2021, round_number = 9, comp = "AFLW") # Return all coaches votes for a particular team fetch_coaches_votes(season = 2021, comp = "AFLM", team = "Western Bulldogs") fetch_coaches_votes(season = 2021, comp = "AFLW", team = "Western Bulldogs") # Return all coaches votes for a particular match fetch_coaches_votes(season = 2021, round_number = 24, comp = "AFLM", team = "Western Bulldogs") fetch_coaches_votes(season = 2021, round_number = 9, comp = "AFLW", team = "Western Bulldogs") ## End(Not run)
fetch_fixture
returns the Fixture for a given AFL Round. Internally, it calls
a corresponding fetch_fixture_*
function that depends on the source given.
By default the source used will be the official AFL website.
fetch_fixture_afl()
, fetch_fixture_footywire()
, fetch_fixture_squiggle()
can be called directly and return data from AFL website, AFL Tables and
Squiggle, respectively.
fetch_fixture( season = NULL, round_number = NULL, comp = "AFLM", source = "AFL", ... ) fetch_fixture_afl(season = NULL, round_number = NULL, comp = "AFLM") fetch_fixture_footywire( season = NULL, round_number = NULL, convert_date = FALSE ) fetch_fixture_squiggle(season = NULL, round_number = NULL)
fetch_fixture( season = NULL, round_number = NULL, comp = "AFLM", source = "AFL", ... ) fetch_fixture_afl(season = NULL, round_number = NULL, comp = "AFLM") fetch_fixture_footywire( season = NULL, round_number = NULL, convert_date = FALSE ) fetch_fixture_squiggle(season = NULL, round_number = NULL)
season |
Season in YYYY format, defaults to NULL which returns the year
corresponding the |
round_number |
Round number, defaults to NULL which returns latest round |
comp |
One of "AFLM" (default), "AFLW", "VFL", "VFLW", "WAFL", "U18B" or "U18G." Not all data sources will have non-AFL data |
source |
One of "AFL" (default), "footywire", "fryzigg", "afltables", "squiggle" |
... |
Optional parameters passed onto various functions depending on source. |
convert_date |
logical, if TRUE, converts date column to date format instead of date time. |
A Tibble with the fixture from the relevant season
and round
.
fetch_fixture_afl for official AFL data.
fetch_fixture_footywire for AFL Tables data.
fetch_fixture_squiggle for Squiggle data.
Other fetch fixture functions:
fetch_player_stats()
## Not run: # Return data for whole season from AFL Website fetch_fixture(2020) # This is equivalent to fetch_fixture(2020, source = "AFL") fetch_fixture_afl(2020) # Return AFLW data fetch_fixture(2020, comp = "AFLW", source = "AFL") fetch_fixture_afl(2020, comp = "AFLW") # Not all sources have AFLW data and will return a warning fetch_fixture(2020, comp = "AFLW", source = "footywire") fetch_fixture(2020, comp = "AFLW", source = "squiggle") # Different sources fetch_fixture(2015, round = 5, source = "footywire") fetch_fixture(2015, round = 5, source = "squiggle") # Directly call functions for each source fetch_fixture_afl(2018, round = 9) fetch_fixture_footywire(2018, round = 9) fetch_fixture_squiggle(2018, round = 9) ## End(Not run)
## Not run: # Return data for whole season from AFL Website fetch_fixture(2020) # This is equivalent to fetch_fixture(2020, source = "AFL") fetch_fixture_afl(2020) # Return AFLW data fetch_fixture(2020, comp = "AFLW", source = "AFL") fetch_fixture_afl(2020, comp = "AFLW") # Not all sources have AFLW data and will return a warning fetch_fixture(2020, comp = "AFLW", source = "footywire") fetch_fixture(2020, comp = "AFLW", source = "squiggle") # Different sources fetch_fixture(2015, round = 5, source = "footywire") fetch_fixture(2015, round = 5, source = "squiggle") # Directly call functions for each source fetch_fixture_afl(2018, round = 9) fetch_fixture_footywire(2018, round = 9) fetch_fixture_squiggle(2018, round = 9) ## End(Not run)
fetch_ladder
returns the Ladder for a given AFL Round. Internally, it calls
a corresponding fetch_ladder_*
function that depends on the source given.
By default the source used will be the official AFL website.
fetch_ladder_afl()
, fetch_ladder_afltables()
, fetch_ladder_squiggle()
can be called directly and return data from AFL website, AFL Tables and
Squiggle, respectively.
fetch_ladder( season = NULL, round_number = NULL, comp = "AFLM", source = "AFL", ... ) fetch_ladder_afl(season = NULL, round_number = NULL, comp = "AFLM") fetch_ladder_afltables( season = NULL, round_number = NULL, match_results_df = NULL ) fetch_ladder_squiggle(season = NULL, round_number = NULL)
fetch_ladder( season = NULL, round_number = NULL, comp = "AFLM", source = "AFL", ... ) fetch_ladder_afl(season = NULL, round_number = NULL, comp = "AFLM") fetch_ladder_afltables( season = NULL, round_number = NULL, match_results_df = NULL ) fetch_ladder_squiggle(season = NULL, round_number = NULL)
season |
Season in YYYY format, defaults to NULL which returns the year
corresponding the |
round_number |
Round number, defaults to NULL which returns latest round |
comp |
One of "AFLM" (default), "AFLW", "VFL", "VFLW", "WAFL", "U18B" or "U18G." Not all data sources will have non-AFL data |
source |
One of "AFL" (default), "footywire", "fryzigg", "afltables", "squiggle" |
... |
Optional parameters passed onto various functions depending on source. |
match_results_df |
(optional) A dataframe from |
A Tibble with the ladder from the relevant season
and round
.
fetch_ladder_afl for official AFL data.
fetch_ladder_afltables for AFL Tables data.
fetch_ladder_squiggle for Squiggle data.
## Not run: # Return data from AFL Website fetch_ladder(2020, round = 1) # This is equivalent to fetch_ladder(2020, round = 1, source = "AFL") fetch_ladder_afl(2020, round = 1) # Return AFLW data fetch_ladder(2020, round = 1, comp = "AFLW", source = "AFL") fetch_ladder_afl(2020, round = 1, comp = "AFLW") # Not all sources have AFLW data and will return a warning fetch_ladder(2020, round = 1, comp = "AFLW", source = "afltables") fetch_ladder(2020, round = 1, comp = "AFLW", source = "squiggle") # Different sources fetch_ladder(2015, round = 5, source = "afltables") fetch_ladder(2015, round = 5, source = "squiggle") # Directly call functions for each source fetch_ladder_afl(2018, round = 9) fetch_ladder_afltables(2018, round = 9) fetch_ladder_squiggle(2018, round = 9) ## End(Not run)
## Not run: # Return data from AFL Website fetch_ladder(2020, round = 1) # This is equivalent to fetch_ladder(2020, round = 1, source = "AFL") fetch_ladder_afl(2020, round = 1) # Return AFLW data fetch_ladder(2020, round = 1, comp = "AFLW", source = "AFL") fetch_ladder_afl(2020, round = 1, comp = "AFLW") # Not all sources have AFLW data and will return a warning fetch_ladder(2020, round = 1, comp = "AFLW", source = "afltables") fetch_ladder(2020, round = 1, comp = "AFLW", source = "squiggle") # Different sources fetch_ladder(2015, round = 5, source = "afltables") fetch_ladder(2015, round = 5, source = "squiggle") # Directly call functions for each source fetch_ladder_afl(2018, round = 9) fetch_ladder_afltables(2018, round = 9) fetch_ladder_squiggle(2018, round = 9) ## End(Not run)
fetch_lineup
returns the Lineup for matches in given AFL Round. Internally, it calls
a corresponding fetch_lineup_*
function that depends on the source given.
By default the source used will be the official AFL website.
fetch_lineup_afl()
can be called directly and return data from AFL website.
fetch_lineup( season = NULL, round_number = NULL, comp = "AFLM", source = "AFL", ... ) fetch_lineup_afl(season = NULL, round_number = NULL, comp = "AFLM")
fetch_lineup( season = NULL, round_number = NULL, comp = "AFLM", source = "AFL", ... ) fetch_lineup_afl(season = NULL, round_number = NULL, comp = "AFLM")
season |
Season in YYYY format, defaults to NULL which returns the year
corresponding the |
round_number |
Round number, defaults to NULL which returns latest round |
comp |
One of "AFLM" (default), "AFLW", "VFL", "VFLW", "WAFL", "U18B" or "U18G." Not all data sources will have non-AFL data |
source |
One of "AFL" (default), "footywire", "fryzigg", "afltables", "squiggle" |
... |
Optional parameters passed onto various functions depending on source. |
A Tibble with the lineup from the relevant season
and round
.
fetch_lineup_afl for official AFL data.
## Not run: # Return data for whole season from AFL Website fetch_lineup(2020) # This is equivalent to fetch_lineup(2020, source = "AFL") fetch_lineup_afl(2020) # Return AFLW data fetch_lineup(2020, comp = "AFLW", source = "AFL") fetch_lineup_afl(2020, comp = "AFLW") # Not all sources have lineup data and will return a warning fetch_lineup(2020, source = "footywire") fetch_lineup(2020, source = "squiggle") # Directly call functions for each source fetch_lineup_afl(2018, round = 9) ## End(Not run)
## Not run: # Return data for whole season from AFL Website fetch_lineup(2020) # This is equivalent to fetch_lineup(2020, source = "AFL") fetch_lineup_afl(2020) # Return AFLW data fetch_lineup(2020, comp = "AFLW", source = "AFL") fetch_lineup_afl(2020, comp = "AFLW") # Not all sources have lineup data and will return a warning fetch_lineup(2020, source = "footywire") fetch_lineup(2020, source = "squiggle") # Directly call functions for each source fetch_lineup_afl(2018, round = 9) ## End(Not run)
fetch_player_details
returns player details such as date of birth, debut
and other details. The exact details that are returned will depend on which
source is provided.
By default the source used will be the official AFL website.
fetch_player_details_afl()
, fetch_player_details_afltables()
and fetch_player_details_footywire()
can be called directly and return data from the AFL website, AFL Tables and Footywire respectively.
The function will typically be used to return the current team lists. For historical data, you can use the current
argument set to FALSE. This will return all historical data for AFL.com and Footywire data. AFLTables data will always return historical data.
fetch_player_details( team = NULL, season = NULL, current = TRUE, comp = "AFLM", source = "AFL", ... ) fetch_player_details_afl( season = NULL, team = NULL, current = TRUE, comp = "AFLM", official_teams = FALSE ) fetch_player_details_afltables(team = NULL) fetch_player_details_footywire(team = NULL, current = TRUE)
fetch_player_details( team = NULL, season = NULL, current = TRUE, comp = "AFLM", source = "AFL", ... ) fetch_player_details_afl( season = NULL, team = NULL, current = TRUE, comp = "AFLM", official_teams = FALSE ) fetch_player_details_afltables(team = NULL) fetch_player_details_footywire(team = NULL, current = TRUE)
team |
team the player played for in the season for, defaults to NULL which returns all teams |
season |
Season in YYYY format |
current |
logical, return the current team list for the current calendar year or all historical data |
comp |
One of "AFLM" (default) or "AFLW" |
source |
One of "AFL" (default), "footywire", "afltables" |
... |
Optional parameters passed onto various functions depending on source. |
official_teams |
boolean, defaults to FALSE. Indicates if we should match |
A Tibble with the details of the relevant players.
fetch_player_details_afl for AFL.com data.
fetch_player_details_footywire for Footywire data.
fetch_player_details_footywire for AFL Tables data.
## Not run: # Return data for current Hawthorn players fetch_player_details("Hawthorn") fetch_player_details("Adelaide", current = FALSE, comp = "AFLW") fetch_player_details("GWS", current = TRUE, csource = "footywire") ## End(Not run)
## Not run: # Return data for current Hawthorn players fetch_player_details("Hawthorn") fetch_player_details("Adelaide", current = FALSE, comp = "AFLW") fetch_player_details("GWS", current = TRUE, csource = "footywire") ## End(Not run)
fetch_player_stats
returns the Individual Player Statistics for AFL games. Internally, it calls
a corresponding fetch_player_stats_*
function that depends on the source given.
By default the source used will be the official AFL website.
fetch_player_stats_footywire()
, fetch_player_stats_afltables()
, fetch_player_stats_fryzigg()
can be called directly and return data from AFL website, AFL Tables and
Squiggle, respectively.
fetch_player_stats( season = NULL, round_number = NULL, comp = "AFLM", source = "AFL", ... ) fetch_player_stats_afl(season = NULL, round_number = NULL, comp = "AFLM") fetch_player_stats_afltables( season = NULL, round_number = NULL, rescrape = FALSE, rescrape_start_season = NULL ) fetch_player_stats_fryzigg(season = NULL, round_number = NULL, comp = "AFLM") fetch_player_stats_footywire( season = NULL, round_number = NULL, check_existing = TRUE )
fetch_player_stats( season = NULL, round_number = NULL, comp = "AFLM", source = "AFL", ... ) fetch_player_stats_afl(season = NULL, round_number = NULL, comp = "AFLM") fetch_player_stats_afltables( season = NULL, round_number = NULL, rescrape = FALSE, rescrape_start_season = NULL ) fetch_player_stats_fryzigg(season = NULL, round_number = NULL, comp = "AFLM") fetch_player_stats_footywire( season = NULL, round_number = NULL, check_existing = TRUE )
season |
Season in YYYY format, defaults to NULL which returns the year
corresponding the |
round_number |
Round number, defaults to NULL which returns latest round |
comp |
One of "AFLM" (default), "AFLW", "VFL", "VFLW", "WAFL", "U18B" or "U18G." Not all data sources will have non-AFL data |
source |
One of "AFL" (default), "footywire", "fryzigg", "afltables", "squiggle" |
... |
Optional parameters passed onto various functions depending on source. |
rescrape |
Logical, defaults to FALSE. Determines if we should re-scrape data for a given season. By default, we return cached data which is much faster. Re-scraping is slow but sometimes needed if historical data has changed. |
rescrape_start_season |
Numeric, if |
check_existing |
logical, should we check existing data. This will likely be removed in future version as it takes a long time to re-scrape data |
A Tibble with the player stats from the relevant season
and round
.
fetch_player_stats_footywire for Footywire data.
fetch_player_stats_afltables for AFL Tables data.
fetch_player_stats_fryzigg for Fryzigg data.
Other fetch fixture functions:
fetch_fixture()
## Not run: # Return data for whole season from footywire fetch_player_stats(source = "footywire") # This is equivalent to fetch_player_stats_footywire() # Currently there is no AFLW data and will return a warning fetch_player_stats(2020, comp = "AFLW", source = "footywire") # Different sources fetch_player_stats(2015, round = 5, source = "footywire") fetch_player_stats(2015, round = 5, source = "fryzigg") # Directly call functions for each source fetch_player_stats_afltables(2020) fetch_fixture_fryzigg(2020) fetch_player_stats_footywire(2020) ## End(Not run)
## Not run: # Return data for whole season from footywire fetch_player_stats(source = "footywire") # This is equivalent to fetch_player_stats_footywire() # Currently there is no AFLW data and will return a warning fetch_player_stats(2020, comp = "AFLW", source = "footywire") # Different sources fetch_player_stats(2015, round = 5, source = "footywire") fetch_player_stats(2015, round = 5, source = "fryzigg") # Directly call functions for each source fetch_player_stats_afltables(2020) fetch_fixture_fryzigg(2020) fetch_player_stats_footywire(2020) ## End(Not run)
fetch_results
returns the results for a given AFL Round. Internally, it calls
a corresponding fetch_results_*
function that depends on the source given.
By default the source used will be the official AFL website.
fetch_results_afl()
, fetch_results_afltables()
, fetch_results_footywire()
, fetch_results_squiggle()
can be called directly and return data from AFL website, AFL Tables, Footywire and
Squiggle, respectively.
fetch_results( season = NULL, round_number = NULL, comp = "AFLM", source = "AFL", ... ) fetch_results_afl(season = NULL, round_number = NULL, comp = "AFLM") fetch_results_afltables(season = NULL, round_number = NULL) fetch_results_footywire( season = NULL, round_number = NULL, last_n_matches = NULL ) fetch_results_squiggle(season = NULL, round_number = NULL)
fetch_results( season = NULL, round_number = NULL, comp = "AFLM", source = "AFL", ... ) fetch_results_afl(season = NULL, round_number = NULL, comp = "AFLM") fetch_results_afltables(season = NULL, round_number = NULL) fetch_results_footywire( season = NULL, round_number = NULL, last_n_matches = NULL ) fetch_results_squiggle(season = NULL, round_number = NULL)
season |
Season in YYYY format, defaults to NULL which returns the year
corresponding the |
round_number |
Round number, defaults to NULL which returns all rounds |
comp |
One of "AFLM" (default), "AFLW", "VFL", "VFLW", "WAFL", "U18B" or "U18G." Not all data sources will have non-AFL data |
source |
One of "AFL" (default), "footywire", "fryzigg", "afltables", "squiggle" |
... |
Optional parameters passed onto various functions depending on source. |
last_n_matches |
number of matches to return, starting from the most recent |
A Tibble with the results from the relevant season
and round
.
fetch_results_afl for official AFL data.
fetch_results_afltables for AFL Tables data.
fetch_results_footywire for Footywire data.
fetch_results_squiggle for Squiggle data.
## Not run: # Return data for whole season from AFL Website fetch_results(2020) # This is equivalent to fetch_results(2020, source = "AFL") fetch_results_afl(2020) # Return AFLW data fetch_results(2020, comp = "AFLW", source = "AFL") fetch_results_afl(2020, comp = "AFLW") # Not all sources have AFLW data and will return a warning fetch_results(2020, comp = "AFLW", source = "footywire") fetch_results(2020, comp = "AFLW", source = "afltables") fetch_results(2020, comp = "AFLW", source = "squiggle") # Different sources fetch_results(2015, round = 5, source = "footywire") fetch_results(2015, round = 5, source = "afltables") fetch_results(2015, round = 5, source = "squiggle") # Directly call functions for each source fetch_results_afl(2018, round = 9) fetch_results_footywire(2018, round = 9) fetch_results_afltables(2018, round = 9) fetch_results_squiggle(2018, round = 9) ## End(Not run)
## Not run: # Return data for whole season from AFL Website fetch_results(2020) # This is equivalent to fetch_results(2020, source = "AFL") fetch_results_afl(2020) # Return AFLW data fetch_results(2020, comp = "AFLW", source = "AFL") fetch_results_afl(2020, comp = "AFLW") # Not all sources have AFLW data and will return a warning fetch_results(2020, comp = "AFLW", source = "footywire") fetch_results(2020, comp = "AFLW", source = "afltables") fetch_results(2020, comp = "AFLW", source = "squiggle") # Different sources fetch_results(2015, round = 5, source = "footywire") fetch_results(2015, round = 5, source = "afltables") fetch_results(2015, round = 5, source = "squiggle") # Directly call functions for each source fetch_results_afl(2018, round = 9) fetch_results_footywire(2018, round = 9) fetch_results_afltables(2018, round = 9) fetch_results_squiggle(2018, round = 9) ## End(Not run)
This function plots the score difference score worms for AFL games.
fetch_score_worm_data(match_id)
fetch_score_worm_data(match_id)
match_id |
AFL match ID (providerId) can be found using |
A ggplot object showing the score worm.
Use fetch_squiggle_data
to access the Squiggle API. See instructions at api.squiggle.com.au.
fetch_squiggle_data( query, ..., user_agent = "fitzRoy Package https://github.com/jimmyday12/fitzRoy" )
fetch_squiggle_data( query, ..., user_agent = "fitzRoy Package https://github.com/jimmyday12/fitzRoy" )
query |
A text string. The main query to use with the API. Please read the Squiggle documentation for information about valid queries |
... |
(optional) An optional argument provided to the Squiggle API. See details for more info. |
user_agent |
(optional) Use this to set something meaningful so that Squiggle admin can contact you if needed. |
Optional arguments can be provided to further restrict the data you are pulling.
For full instructions, see api.squiggle.com.au
A dataframe, with the resultant data that matches the query specified in query
, as well as any optional filters.
## Not run: # Return a list of the sources, with ID's sources <- fetch_squiggle_data("sources") # Get tips for Round 1, 2018 tips <- fetch_squiggle_data(query = "tips", round = 1, year = 2018) # Get tips from Squiggle 2019 squiggle <- fetch_squiggle_data(query = "tips", source = 1, year = 2019) ## End(Not run)
## Not run: # Return a list of the sources, with ID's sources <- fetch_squiggle_data("sources") # Get tips for Round 1, 2018 tips <- fetch_squiggle_data(query = "tips", round = 1, year = 2018) # Get tips from Squiggle 2019 squiggle <- fetch_squiggle_data(query = "tips", source = 1, year = 2019) ## End(Not run)
get_afl_colour_palettes
returns a data frame containing the AFL team's primary, secondary and tertiary colours as applicable
The data for this function is hosted on github.
get_afl_colour_palettes()
get_afl_colour_palettes()
a data table containing team long name, team abbreviation, and colours
## Not run: # Gets all data get_afl_colour_palettes() ## End(Not run)
## Not run: # Gets all data get_afl_colour_palettes() ## End(Not run)
Gets a cookie from http://www.afl.com.au/ to authenticate further requests.
get_afl_cookie()
get_afl_cookie()
token code
## Not run: cookie <- get_afl_cookie() ## End(Not run)
## Not run: cookie <- get_afl_cookie() ## End(Not run)
Get detailed AFLW data
get_aflw_detailed_data(matchids)
get_aflw_detailed_data(matchids)
matchids |
vector of match IDs, like those returned by
|
Dataframe with detailed match data. Each row is a match.
## Not run: get_aflw_detailed_data(c("CD_M20172640101", "CD_M20172640102")) ## End(Not run)
## Not run: get_aflw_detailed_data(c("CD_M20172640101", "CD_M20172640102")) ## End(Not run)
Gets detailed match data for a given match. Requires the match, round, and
competition IDs, which are given in the tables produced by
get_aflw_round_data()
get_aflw_detailed_match_data(matchid, roundid, competitionid, cookie)
get_aflw_detailed_match_data(matchid, roundid, competitionid, cookie)
matchid |
matchid from |
roundid |
roundid from |
competitionid |
competitionid from |
cookie |
cookie from |
Dataframe with detailed match data (wide)
## Not run: get_aflw_detailed_match_data( "CD_M20172640101", "CD_R201726401", "CD_S2017264", get_aflw_cookie() ) ## End(Not run)
## Not run: get_aflw_detailed_match_data( "CD_M20172640101", "CD_R201726401", "CD_S2017264", get_aflw_cookie() ) ## End(Not run)
For a given round ID, get the data for each match played in that round. Use
the column roundId
in the dataframe created by the get_rounds()
function
to specify matches to fetch.
get_aflw_round_data(roundid, cookie)
get_aflw_round_data(roundid, cookie)
roundid |
a round ID string |
cookie |
a cookie produced by |
a dataframe containing match data
## Not run: get_aflw_round_data("CD_R201826401", get_aflw_cookie()) ## End(Not run)
## Not run: get_aflw_round_data("CD_R201826401", get_aflw_cookie()) ## End(Not run)
Returns data frame for available round data. Includes the rounds played, as well as identifiers to make further requests, importantly the roundId.
get_aflw_rounds(cookie)
get_aflw_rounds(cookie)
cookie |
a cookie produced by |
A dataframe with information about each round
## Not run: get_aflw_rounds(get_aflw_cookie()) ## End(Not run)
## Not run: get_aflw_rounds(get_aflw_cookie()) ## End(Not run)
This function has been deprecated due to its inefficiency
get_score_progression_raw()
get_score_progression_raw()
# ## Not run: get_match_results() # -> fetch_results_afltables() ## End(Not run)
# ## Not run: get_match_results() # -> fetch_results_afltables() ## End(Not run)
Internal function to ensure names match between different sources and also name changes. This gets applied to any web scraper
parse_team_abbr(team_name)
parse_team_abbr(team_name)
team_name |
Team name |
This function plots the score difference score worms for AFL games.
plot_score_worm(match_id)
plot_score_worm(match_id)
match_id |
AFL match ID (providerId) can be found using |
A ggplot object showing the score worm.
This function plots the team totals score worm for AFL games.
plot_score_worm_totals(match_id)
plot_score_worm_totals(match_id)
match_id |
AFL match ID (providerId) can be found using |
A ggplot object showing the total score worm.
Internal function to ensure names match between different sources and also name changes. This gets applied to any web scraper
replace_teams(team)
replace_teams(team)
team |
Team name |
Internal function to ensure venue names match between different sources and also name changes across time. This gets applied to any web scraper, transforming all of them to AFL Tables naming conventions.
replace_venues(venue)
replace_venues(venue)
venue |
Venue name |
Internal function to return team name abbreviation for AFL API
team_abr_afl(team)
team_abr_afl(team)
team |
Team name |