RPFF is an R library developed by PFF FC. It provides convenient access to the PFF FC API from applications written in R.
If you have a question that is not addressed here, there are several ways to get in touch:
- Open a GitHub Issue
- Request a Feature
- Drop us a note at [email protected]
See the PFF FC API Documentation. This documentation also includes PFF FC’s data specification.
PFF FC offers a Sandbox environment which provides convenient access to one competition of your choosing, completely free of charge. The Sandbox is a test environment. As part of your access and use of the Sandbox you acknowledge that you have read, understood and agree to all terms of the User Agreement.
Use your unique PFF FC API key or request an API key to PFF FC’s free-forever Sandbox environment by emailing [email protected].
Installing RPFF requires devtools
, if not yet installend, run install.packages("devtools")
devtools::install_github("pro-football-focus/rpff")
After successfully installing the package, import it:
library(RPFF)
Make sure to set your environment variables to the URL and key that your are provided with.
Sys.setenv("pff-api-url" = "<<provided URL>>")
Sys.setenv("x-api-key" = "<<provided key>>")
In order to retrieve all competitions available to you, run:
get_competitions()
Or alternatively, request a specific competition only:
get_competition(competition_id)
In order to retrieve all teams available to you, run:
get_teams()
Or alternatively, request a specific team only:
get_team(team_id)
In order to retrieve all games from a specific competition, run:
get_games(competition_id)
Or alternatively, request a specific game only:
get_game(game_id)
In order to retrieve all players from a specific competition, run:
get_players_competition(competition_id)
Or alternatively, request a specific player only:
get_player(player_id)
In order to retrieve the roster of a specific game, run:
get_roster(game_id)
In order to retrieve all events of a specific game, run:
get_gameEvents(game_id)
Or alternatively, request a specific event only:
get_gameEvent(game_event_id)
GraphQL is the query language for PFF FC’s APIs and provides an alternative to REST and ad-hoc webservice architectures. It allows clients to define the structure of the data required, and exactly the same structure of the data is returned from the server. It is a strongly typed runtime which allows clients to dictate what data is needed.