Learn R Programming

⚠️There's a newer version (1.6.0) of this package.Take me there.

fitzRoy

Overview

The goal of fitzRoy is to provide a set of functions that allows for users to easily get access to AFL data from sources such as afltables.com and footywire.com. There are also tools for processing and cleaning that data.

Installation

Install the released version of fitzRoy from CRAN:

install.packages("fitzRoy")

Or install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("jimmyday12/fitzRoy")

Usage

The fitzRoy package can be used to simply get data from various sources.

Getting Data

Primarily, the tool can be used to access data from various sources. Data is included in the package and can be access directly however this will not be up to date. Each source of data has functions for updating data during the season.

Mens data

Various data is included from both AFL Tables and Footy Wire. At the most basic level, you can access match results and the upcoming fixture as below. Read the full Mens Vignette for further instructions.

results <- get_match_results()
fixture <- get_fixture(season = 2019)

AFL Womens data

From 2019, we are able to provide access to AFL Women’s data. Read the full AFL Womens Vingette for details on how to access it.

NOTE: The AFL website has taken down the Women’s stats pages during the 2019/2020 offseason, so these functions no longer work. This is left for posterity and in the hope that they go back up evenually.

aflw_match_data <- get_aflw_match_data()

ELO models

A specific use case might be to use fitzRoy data as an input into a model. See the ELO model vignette for an example of how this might be done.

Docker Support

fitzRoy now provides Docker support in the form of an image hosted on DockerHub.

Usage

Once you have the images, (e.g. docker pull jimmyday12/fitzroy:latest) run one of the following commands.

  • To start RStudio with Fitzroy ready to use:
    • docker run -d -p 8787:8787 --name fitzroy jimmyday12/fitzroy:latest and open http://localhost:8787. *(Username: rstudio, Password: rstudio)
  • To start an R terminal prompt with fitzRoy ready to use:
    • docker run -it jimmyday12/fitzroy:latest R to start with an R terminal prompt.
    • Run quit() to exit the container

Building the image locally

To build the Docker image run the following from the root of the repository.

  • docker build -t jimmyday12/fitzroy:latest -f docker/rstudio/Dockerfile .

Please note that the ‘fitzRoy’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Copy Link

Version

Install

install.packages('fitzRoy')

Monthly Downloads

555

Version

0.3.2

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

James Day

Last Published

May 23rd, 2020

Functions in fitzRoy (0.3.2)

get_footywire_stats

Scrape footywire player statistics.
update_footywire_stats

Update the included footywire stats data to the specified date.
get_aflw_rounds

Get rounds (internal function)
scrape_afltables_match

Return afltables player match stats
get_aflw_round_data

Get match data (internal function)
get_footywire_betting_odds

Get AFL match betting odds from https://www.footywire.com
get_fixture

Get upcoming fixture from https://www.footywire.com
get_match_data

Helper function for get_footywire_stats
get_squiggle_data

Access Squiggle data using the squiggle API service.
replace_teams

Internal function to ensure names match between different sources and also name changes. This gets applied to any web scraper
get_match_results

Get basic match results from afltables.com
replace_venues

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.
return_ladder

Recreate the ladder for every or any given round and/or season
get_score_progression_raw

Get raw score progression data
get_aflw_detailed_data

Get detailed AFLW data
calculate_round

Helper function for get_fixture,betting_data
convert_results

Convert AFL Men's results into long format
get_aflw_cookie

Get AFL Stats cookie (internal function)
get_aflw_detailed_match_data

Get detailed womens match data (internal function)
get_afltables_stats

Return afltables match stats
get_afltables_urls

Return match URLs for specified dates
get_aflw_match_data

Get AFLW match data
fitzRoy-package

fitzRoy: Easily Scrape and Process AFL Data
footywire_html

Helper function for get_footywire_stats