Save your API Key as a system environment variable
To get access to an API key, follow the instructions at https://collegefootballdata.com/key
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
a new script will pop open named
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
Build) and click
(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")