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.
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("saiemgilani/cfbfastR", dependencies = TRUE, update = TRUE)
The CollegeFootballData API now requires an API key, here’s a quick run-down:
To get an API key, follow the directions here: College Football Data Key Registration.
Using the key: You can save the key for consistent usage by adding CFBD_API_KEY=XXXX-YOUR-API-KEY-HERE-XXXXX
to your .Renviron file (easily accessed via usethis::edit_r_environ()
). Run usethis::edit_r_environ()
, a new script will pop open named .Renviron
, THEN paste the following in the new script that pops up (without quotations)
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.
CFBD_API_KEY
(with quotations) using a command like the following.
Sys.setenv(CFBD_API_KEY = "XXXX-YOUR-API-KEY-HERE-XXXXX")