Fetching Player Details

not_cran = identical(Sys.getenv("NOT_CRAN"), "true")
online <- !is.null(curl::nslookup("r-project.org", error = FALSE))
eval_param <- not_cran & online
eval_param <- packageVersion("fitzRoy") == "1.1.0.9000"

knitr::opts_chunk$set(
    eval = eval_param,
    message = FALSE,
    warning = FALSE,
    collapse = TRUE,
    comment = "#>"
)
#devtools::install_github("jimmyday12/fitzRoy")
library(fitzRoy)
library(dplyr)

A special case of the fetch_ family of functions is the fetch_player_details_ set of functions. You can read the general explanation of how to use the main fetch functions on the Vignette. The player details functions accepts slightly different arguments.

Basic Usage

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.

fetch_player_details("Hawthorn")
fitzRoy:::details_aflm

The AFL website will return AFLW or AFLM data, while other sources only include AFLM data.

details_aflw <- fetch_player_details(team = "Western Bulldogs", current = TRUE, comp = "AFLW", source = "AFL")

head(details_aflw)
details_aflw <- fitzRoy:::details_aflw
head(details_aflw)

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

glimpse(details_aflw)

The AFLTables.com source will return all players who have played for the specified team over time.

fetch_player_details("Hawthorn", source = "afltables")
fitzRoy:::details_afltables

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)
fitzRoy:::details_footywire

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.

fetch_player_details("Greater Western Sydney", source = "afltables")


Try the fitzRoy package in your browser

Any scripts or data that you put into this service are public.

fitzRoy documentation built on March 7, 2023, 6:45 p.m.