Find game_pk values for professional baseball games (major and minor leagues) via the MLB api https://www.mlb.com/
Usage
mlb_game_pks(date, level_ids = c(1))
Arguments
- date
The date for which you want to find game_pk values for MLB games
- level_ids
A numeric vector with ids for each level where game_pks are desired. See below for a reference of level ids.
Value
Returns a tibble that includes game_pk values and additional information for games scheduled or played with the following columns:
col_name | types |
game_pk | integer |
link | character |
gameType | character |
season | character |
gameDate | character |
officialDate | character |
isTie | logical |
gameNumber | integer |
publicFacing | logical |
doubleHeader | character |
gamedayType | character |
tiebreaker | character |
calendarEventID | character |
seasonDisplay | character |
dayNight | character |
scheduledInnings | integer |
reverseHomeAwayStatus | logical |
inningBreakLength | integer |
gamesInSeries | integer |
seriesGameNumber | integer |
seriesDescription | character |
recordSource | character |
ifNecessary | character |
ifNecessaryDescription | character |
status.abstractGameState | character |
status.codedGameState | character |
status.detailedState | character |
status.statusCode | character |
status.startTimeTBD | logical |
status.abstractGameCode | character |
teams.away.score | integer |
teams.away.isWinner | logical |
teams.away.splitSquad | logical |
teams.away.seriesNumber | integer |
teams.away.leagueRecord.wins | integer |
teams.away.leagueRecord.losses | integer |
teams.away.leagueRecord.pct | character |
teams.away.team.id | integer |
teams.away.team.name | character |
teams.away.team.link | character |
teams.home.score | integer |
teams.home.isWinner | logical |
teams.home.splitSquad | logical |
teams.home.seriesNumber | integer |
teams.home.leagueRecord.wins | integer |
teams.home.leagueRecord.losses | integer |
teams.home.leagueRecord.pct | character |
teams.home.team.id | integer |
teams.home.team.name | character |
teams.home.team.link | character |
venue.id | integer |
venue.name | character |
venue.link | character |
content.link | character |
Details
Level IDs:
The following IDs can be passed to the level_ids argument:
1 = MLB 11 = Triple-A 12 = Doubl-A 13 = Class A Advanced 14 = Class A 15 = Class A Short Season 5442 = Rookie Advanced 16 = Rookie 17 = Winter League
Examples
# \donttest{
try(mlb_game_pks("2019-04-29"))
#> ── MLB Game Pks data from MLB.com ─────────────────── baseballr 1.2.0 ──
#> ℹ Data updated: 2022-04-30 07:16:01 UTC
#> # A tibble: 9 × 54
#> game_pk link gameType season gameDate officialDate isTie gameNumber
#> <int> <chr> <chr> <chr> <chr> <chr> <lgl> <int>
#> 1 565909 /api/v… R 2019 2019-04… 2019-04-29 FALSE 1
#> 2 566001 /api/v… R 2019 2019-04… 2019-04-29 FALSE 1
#> 3 565040 /api/v… R 2019 2019-04… 2019-04-29 FALSE 1
#> 4 567173 /api/v… R 2019 2019-04… 2019-04-29 FALSE 1
#> 5 566975 /api/v… R 2019 2019-04… 2019-04-29 FALSE 1
#> 6 567566 /api/v… R 2019 2019-04… 2019-04-29 FALSE 1
#> 7 567275 /api/v… R 2019 2019-04… 2019-04-29 FALSE 1
#> 8 565717 /api/v… R 2019 2019-04… 2019-04-29 FALSE 1
#> 9 566484 /api/v… R 2019 2019-04… 2019-04-29 FALSE 1
#> # … with 46 more variables: publicFacing <lgl>, doubleHeader <chr>,
#> # gamedayType <chr>, tiebreaker <chr>, calendarEventID <chr>,
#> # seasonDisplay <chr>, dayNight <chr>, scheduledInnings <int>,
#> # reverseHomeAwayStatus <lgl>, inningBreakLength <int>,
#> # gamesInSeries <int>, seriesGameNumber <int>,
#> # seriesDescription <chr>, recordSource <chr>, ifNecessary <chr>,
#> # ifNecessaryDescription <chr>, status.abstractGameState <chr>, …
# }