Skip to contents

Get the scores for the sports which the Odds API provides coverage

try(toa_sports_scores(sport_key = 'baseball_mlb', 
                         days_from = NULL,
                         date_format = 'iso'))

Usage

toa_sports_scores(sport_key, days_from = 1, date_format = "iso")

Arguments

sport_key

(string, required): The sport_key to look up odds for. See toa_sports() for a full lookup of sport_key values.

days_from

(integer, optional): Integer from 1 to 3. Defaults to 1.

date_format

(string, optional): Date format. Options include:

  • iso

  • unix

Value

Sports scores which The Odds API provides scores information for as a tibble:

col_nametypes
idcharacter
sport_keycharacter
sport_titlecharacter
commence_timecharacter
completedlogical
home_teamcharacter
away_teamcharacter
scoreslogical
last_updatelogical

Examples

# \donttest{
   try(toa_sports_scores(sport_key = 'baseball_mlb', 
                         days_from = NULL,
                         date_format = 'iso'))
#> ── Sports Odds data from the-odds-api.com ──────────── oddsapiR 0.0.1 ──
#>  Data updated: 2022-06-21 17:38:50 UTC
#> # A tibble: 15 × 9
#>    id            sport_key sport_title commence_time completed home_team
#>    <chr>         <chr>     <chr>       <chr>         <lgl>     <chr>    
#>  1 142e714d1888… baseball… MLB         2022-06-21T2… FALSE     Cincinna…
#>  2 04c47ff0f152… baseball… MLB         2022-06-21T2… FALSE     Miami Ma…
#>  3 c74d38ee5c25… baseball… MLB         2022-06-21T2… FALSE     Baltimor…
#>  4 3fa4d180ce3e… baseball… MLB         2022-06-21T2… FALSE     Pittsbur…
#>  5 fa81d1b98ecb… baseball… MLB         2022-06-21T2… FALSE     Tampa Ba…
#>  6 4b77bb1b03f7… baseball… MLB         2022-06-21T2… FALSE     Boston R…
#>  7 cd26b6bbcf45… baseball… MLB         2022-06-21T2… FALSE     Atlanta …
#>  8 08ffd3b95277… baseball… MLB         2022-06-21T2… FALSE     Minnesot…
#>  9 c0e018c0e5db… baseball… MLB         2022-06-22T0… FALSE     Texas Ra…
#> 10 8095252f9335… baseball… MLB         2022-06-22T0… FALSE     Chicago …
#> 11 5c942a8684b1… baseball… MLB         2022-06-22T0… FALSE     Houston …
#> 12 c6f22fee7fe7… baseball… MLB         2022-06-22T0… FALSE     Milwauke…
#> 13 fe7eba596c2b… baseball… MLB         2022-06-22T0… FALSE     Los Ange…
#> 14 c9c99c5af13d… baseball… MLB         2022-06-22T0… FALSE     San Dieg…
#> 15 1b2992c9053f… baseball… MLB         2022-06-22T0… FALSE     Oakland …
#> # … with 3 more variables: away_team <chr>, scores <lgl>,
#> #   last_update <lgl>
# }