
To access the API, get a free API key fromhttps://the-odds-api.com
Installation & Usage
You can install the released version ofoddsapiRfromGitHubwith:
# 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/oddsapiR")# if you would prefer devtools installationif (!requireNamespace('devtools',quietly =TRUE)){install.packages('devtools')}# Alternatively, using the devtools package:devtools::install_github(repo ="sportsdataverse/oddsapiR")git clone https://github.com/sportsdataverse/oddsapicd oddsapiRscript-e"devtools::install()"TheOdds API requires an APIkey, here’s a quick run-down:
ODDS_API_KEY=XXXX-YOUR-API-KEY-HERE-XXXXX to your .Renvironfile (easily accessed viausethis::edit_r_environ()).Runusethis::edit_r_environ(),a new script will pop open named.Renviron,THEN paste the following in the new script that pops up(without quotations)ODDS_API_KEY= XXXX-YOUR-API-KEY-HERE-XXXXXSave the script andrestart your RStudio session, byclickingSession (in betweenPlots andBuild) and clickRestart R (there also existsthe shortcutCtrl + Shift + F10 to restart your session).If set correctly, from then on you should be able to use any of thefunctions without any other changes.
ODDS_API_KEY (with quotations) using a command like thefollowing.Sys.setenv(ODDS_API_KEY ="XXXX-YOUR-API-KEY-HERE-XXXXX")For more information on the package and function reference, pleasesee theoddsapiRdocumentation website.
To cite theoddsapiRR package in publications, use:
BibTex Citation
@misc{gilani_2022_oddsapiR,author = {Gilani, Saiem},title = {oddsapiR: The SportsDataverse's R Package for The Odds API.},url = {https://oddsapiR.sportsdataverse.org},year = {2022}}