Learn R Programming

cfbfastR

The goal of cfbfastR is to provide the community with an R package for working with CFB data. It is an R API wrapper around https://collegefootballdata.com/. Beyond data aggregation and tidying ease, one of the multitude of services that cfbfastR provides is for benchmarking open-source expected points and win probability metrics.

Installation

You can install the CRAN version of cfbfastR with:

install.packages("cfbfastR")

You can install the released version of cfbfastR from GitHub with:

# You can install using the pacman package using the following code:
if (!requireNamespace('pacman', quietly = TRUE)){
  install.packages('pacman')
}
pacman::p_load_current_gh("sportsdataverse/cfbfastR", dependencies = TRUE, update = TRUE)

Breaking Changes

Full News on Releases

College Football Data API Keys

The CollegeFootballData API now requires an API key, here’s a quick run-down:

CFBD_API_KEY = XXXX-YOUR-API-KEY-HERE-XXXXX

Save the script and restart your RStudio session, by clicking Session (in between Plots and Build) and click Restart R (there also exists the shortcut Ctrl + Shift + F10 to restart your session). If set correctly, from then on you should be able to use any of the cfbd_ functions without any other changes.

  • For less consistent usage: At the beginning of every session or within an R environment, save your API key as the environment variable CFBD_API_KEY (with quotations) using a command like the following.
Sys.setenv(CFBD_API_KEY = "XXXX-YOUR-API-KEY-HERE-XXXXX")

Follow cfbfastR and the SportsDataverse on Twitter and star this repo

Our Authors

Our Contributors (they’re awesome)

Authors Emeritus - cfbscrapR[archived]

Special Thanks

Citations

To cite the cfbfastR R package in publications, use:

BibTex Citation

@misc{gilani_et_al_2021_cfbfastr,
  author = {Saiem Gilani and Akshay Easwaran and Jared Lee and Eric Hess},
  title = {cfbfastR: The SportsDataverse's R Package for College Football Data.},
  url = {https://cfbfastR.sportsdataverse.org/},
  year = {2021}
}

Copy Link

Version

Install

install.packages('cfbfastR')

Monthly Downloads

49

Version

1.9.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Saiem Gilani

Last Published

June 13th, 2022

Functions in cfbfastR (1.9.0)

cfbd_draft_teams

Get list of NFL teams
cfbd_calendar

Get calendar of weeks by season.
cfbd_betting_lines

CFBD Betting Lines Endpoint Overview
cfbd_draft_positions

Get list of NFL positions
cfbd_draft

CFBD NFL Draft Endpoint Overview
cfbd_draft_picks

Get list of NFL draft picks
cfbd_coaches

CFBD Coaches Endpoint Overview
cfbd_conferences

CFBD Conferences Endpoint Overview
cfbd_drives

CFBD Drives Endpoint
cfbd_game_player_stats

Get player statistics by game
cfbd_game_box_advanced

Get game advanced box score information.
cfbd_game_info

Get results information from games.
cfbd_game_weather

Get weather from games.
cfbd_game_media

Get game media information (TV, radio, etc).
cfbd_game_team_stats

Get team statistics by game
cfbd_metrics_wp

Get win probability chart data from API
cfbd_metrics_ppa_teams

Get team averages for predicted points added (PPA)
cfbd_metrics

CFBD Metrics Endpoint Overview
cfbd_play

CFBD Plays Endpoint Overview
cfbd_games

CFBD Games Endpoint Overview
cfbd_ratings

CFBD Ratings and Rankings Endpoints Overview
cfbd_play_stats_player

Gets player info associated by play
cfbd_ratings_elo

Get Elo historical rating data
cfbd_stats

CFBD Stats Endpoint Overview
cfbd_player_info

Player information lookup
cfbd_player_returning

Get player returning production
cfbd_stats_categories

Get stats categories
cfbd_metrics_ppa_players_season

Get player season averages for predicted points added (PPA)
cfbd_metrics_ppa_players_games

Get player game averages for predicted points added (PPA)
cfbd_metrics_ppa_games

Get team game averages for predicted points added (PPA)
cfbd_metrics_wp_pregame

Get pre-game win probability data from API
cfbd_recruiting_player

Get player recruiting rankings
cfbd_pbp_data

Get college football play by play data with cfbfastR expected points/win probability added
cfbd_player_usage

Get player usage metrics
cfbd_players

CFBD Players Endpoint Overview
cfbd_ratings_sp

Get SP historical rating data
cfbd_ratings_sp_conference

Get conference level SP historical rating data
cfbd_ratings_srs

Get SRS historical rating data
cfbd_stats_game_advanced

Get game advanced stats
cfbd_metrics_ppa_predicted

Calculate predicted points using down and distance
cfbd_play_stats_types

Get college football mapping for play stats types
cfbd_stats_season_advanced

Get season advanced statistics by team
cfbd_game_records

Get team records by year
cfbd_stats_season_player

Get season statistics by player
cfbd_stats_season_team

Get season statistics by team
load_cfb_teams

Load CFB team info from the data repo
rds_from_url

Load .rds file from a remote connection
cfbd_recruiting_position

Get college football position group recruiting information.
espn_ratings_fpi

ESPN FPI Ratings
cfbd_recruiting

CFB Recruiting Endpoint Overview
espn_metrics

ESPN Metrics
cfbd_team_info

Team info lookup
espn_cfb_scoreboard

ESPN Scoreboard
cfbd_team_matchup

Get matchup history between two teams.
espn_cfb_team_stats

Get ESPN college football team stats data
cfbfastR-package

cfbfastR: Access College Football Play by Play Data
cfbd_venues

CFBD Venues Endpoint Overview
cfbd_plays

Get college football play-by-play data.
cfbd_team_talent

Get composite team talent rankings for all teams in a given year
cfbd_play_types

Get college football mapping for play types
cfbd_teams

CFBD Teams Endpoint Overview
cfbd_recruiting_transfer_portal

Get Transfer Portal Data
cfbd_recruiting_team

Get college football recruiting team rankings information.
espn_cfb_calendar

ESPN Calendar
cfbd_rankings

Get historical Coaches and AP poll data
espn_cfb_pbp

Get ESPN college football PBP data
cfbd_team_matchup_records

Get matchup history records between two teams.
load_cfb_rosters

Load College Football Rosters
load_cfb_schedules

Load CFB Game/Schedule Data from data repo
csv_from_url

Load .csv / .csv.gz file from a remote connection
register_cfbd

CFBD API Key Registration
data

Data in the package for reference
cfbd_team_roster

Get team rosters
create_epa

Create EPA
helpers_pbp

Series of functions to help clean the play-by-play data for analysis
load_cfb_pbp

Load cleaned play-by-play from the data repo
update_cfb_db

Update or create a cfbfastR play-by-play database
create_wpa

Create WPA