Here you will find details about the R package fantasysocceR, which contains datasets and functions for playing and interacting with the official fantasy football game (fantasy.premierleague.com). The package is hosted on github, you can find it here, there is also a short post introducing the package here.
To install and load the package (devtools must be installed first):
# install.packages("devtools")
devtools::install_github(repo = "fantasysocceR", user = "durtal")
There are 3 stable datasets that come with the package, these datasets were updated after the 2014/15 Premier League season was completed. The datasets are:
There are also 2 datasets with data, collected on Aug 3, 2015, with data about the 2015/16 season, these are:
There are a few functions included in the package, one of which collects up-to-date fantasy football data, the function is collect_ff
. This function returns a list of players and their performance data. This list can then be converted to neat dataframes using some of the packages other functions, these are players_df
, pastseasons_df
and currentseasons_df
. To see these functions in action see here.
Another function, team_pal
provides a simple palette for the teams in the 2014/15 season, this palette can then be used in conjunction with ggplot2
to create some nice plots.