This vignette is an introduction to the principles and functions of the fplr package. Note that functions that are dependent on the season being live are not actually evaluated.

1. Basics

What is Fantasy Premier League?

Fantasy Premier League (FPL) is the official fantasy football game of the Premier League, the top competitive football division in England. FPL players compete to score the most points come the end of the season (following these rules).

What is fplr?

fplr is an R package that houses tools for working with FPL data in R. This toolset mostly consists of functions to help with FPL managers’ (referred to herein as users), players’, teams’ and fixtures data, for current and previous seasons of the game.

N.B. The package mostly retrieves this data from endpoints across the FPL site (for example, the bootstrap-static endpoint). At time of writing, there is no formal developer support, and so any sudden game alterations that affect the data structure may cause functionality in this package to break. File any issues over at the Github repo issue tracker.

2. Players

Functions in the player data family primarily return information about players in the game, and are mostly for exploring data in the current season (note - when a new season of the game begins, old season data returned from these functions will be overwritten).

These functions follow the naming convention fpl_get_player_xxx. For example, fpl_get_player_all() returns data for all players in the current season, via a tidy tibble:

Get gameweek-level data for a single player in the current season, using fpl_get_player_current() (supplying a player_id value, possibly gleaned from the fpl_get_player_all() output):

fpl_get_player_current(player_id = 3)

You can even get historic seasons’ data (if it exists) for a player, using fpl_get_player_historic:

3. Users

Functions in the user data family primarily return information about users, and like the players functions already covered, are mostly for exploring data in the current season (again - when a new season of the game begins, data from these functions may be overwritten).

These functions follow the naming convention fpl_get_user_xxx. Get information on current season performance of a user by supplying the corresponding user_id (taken from the main FPL website) to the fpl_get_user_current() function:

fpl_get_user_current(user_id = 137633)

Or, get historic seasons performance using fpl_get_user_history():

fpl_get_user_history(user_id = 137633)