Learn R Programming

baseballr (version 1.6.0)

mlb_game_pks: Get MLB Game Info by Date and Level

Description

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))

Value

Returns a tibble that includes game_pk values and additional information for games scheduled or played with the following columns:

col_nametypes
game_pkinteger
linkcharacter
gameTypecharacter
seasoncharacter
gameDatecharacter
officialDatecharacter
isTielogical
gameNumberinteger
publicFacinglogical
doubleHeadercharacter
gamedayTypecharacter
tiebreakercharacter
calendarEventIDcharacter
seasonDisplaycharacter
dayNightcharacter
scheduledInningsinteger
reverseHomeAwayStatuslogical
inningBreakLengthinteger
gamesInSeriesinteger
seriesGameNumberinteger
seriesDescriptioncharacter
recordSourcecharacter
ifNecessarycharacter
ifNecessaryDescriptioncharacter
status.abstractGameStatecharacter
status.codedGameStatecharacter
status.detailedStatecharacter
status.statusCodecharacter
status.startTimeTBDlogical
status.abstractGameCodecharacter
teams.away.scoreinteger
teams.away.isWinnerlogical
teams.away.splitSquadlogical
teams.away.seriesNumberinteger
teams.away.leagueRecord.winsinteger
teams.away.leagueRecord.lossesinteger
teams.away.leagueRecord.pctcharacter
teams.away.team.idinteger
teams.away.team.namecharacter
teams.away.team.linkcharacter
teams.home.scoreinteger
teams.home.isWinnerlogical
teams.home.splitSquadlogical
teams.home.seriesNumberinteger
teams.home.leagueRecord.winsinteger
teams.home.leagueRecord.lossesinteger
teams.home.leagueRecord.pctcharacter
teams.home.team.idinteger
teams.home.team.namecharacter
teams.home.team.linkcharacter
venue.idinteger
venue.namecharacter
venue.linkcharacter
content.linkcharacter

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.

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

Run this code
# \donttest{
  try(mlb_game_pks("2019-04-29"))
# }

Run the code above in your browser using DataLab