Skip to contents

Acquire time codes for Major and Minor League games

Usage

mlb_game_changes(updated_since, sport_id)

Arguments

updated_since

Updated since date time

sport_id

Return division(s) for all divisions in a specific sport.

Value

Returns a tibble that includes time codes from the game_pk requested

col_nametypesdescription
datecharacterSchedule date (YYYY-MM-DD).
total_itemsintegerTotal items for the date.
total_eventsintegerTotal events for the date.
total_gamesintegerTotal games for the date.
total_games_in_progressintegerGames currently in progress for the date.
game_pkintegerUnique game identifier.
game_guidcharacterGlobally unique game identifier.
linkcharacterMLB Stats API relative game link.
game_typecharacterGame type code (R, P, D, etc.).
seasoncharacterSeason (YYYY).
game_datecharacterGame date-time (ISO 8601, UTC).
official_datecharacterOfficial game date (YYYY-MM-DD).
is_tielogicalWhether the game ended in a tie.
game_numberintegerGame number within a doubleheader.
public_facinglogicalWhether the game is public-facing.
double_headercharacterDoubleheader indicator (N/Y/S).
gameday_typecharacterGameday data type code.
tiebreakercharacterTiebreaker indicator.
calendar_event_idcharacterCalendar event identifier.
season_displaycharacterDisplay season (YYYY).
day_nightcharacterDay/night designation.
descriptioncharacterGame description.
scheduled_inningsintegerNumber of scheduled innings.
reverse_home_away_statuslogicalWhether home/away designation is reversed.
inning_break_lengthintegerLength of the inning break (seconds).
games_in_seriesintegerTotal games in the series.
series_game_numberintegerGame number within the series.
series_descriptioncharacterSeries description.
record_sourcecharacterSource of the record data.
if_necessarycharacterWhether the game is played only if necessary.
if_necessary_descriptioncharacterIf-necessary description.
status_abstract_game_statecharacterAbstract game state (e.g. Final).
status_coded_game_statecharacterCoded game state.
status_detailed_statecharacterDetailed game state.
status_status_codecharacterGame status code.
status_start_time_tbdlogicalWhether the start time is TBD.
status_abstract_game_codecharacterAbstract game code.
teams_away_scoreintegerAway team score.
teams_away_is_winnerlogicalWhether the away team won.
teams_away_split_squadlogicalWhether the away team is a split squad.
teams_away_series_numberintegerAway team series number.
teams_away_team_idintegerAway team MLB ID.
teams_away_team_namecharacterAway team name.
teams_away_team_linkcharacterMLB Stats API relative away team link.
teams_away_league_record_winsintegerAway team league-record wins.
teams_away_league_record_lossesintegerAway team league-record losses.
teams_away_league_record_tiesintegerAway team league-record ties.
teams_away_league_record_pctcharacterAway team winning percentage.
teams_home_scoreintegerHome team score.
teams_home_is_winnerlogicalWhether the home team won.
teams_home_split_squadlogicalWhether the home team is a split squad.
teams_home_series_numberintegerHome team series number.
teams_home_team_idintegerHome team MLB ID.
teams_home_team_namecharacterHome team name.
teams_home_team_linkcharacterMLB Stats API relative home team link.
teams_home_league_record_winsintegerHome team league-record wins.
teams_home_league_record_lossesintegerHome team league-record losses.
teams_home_league_record_tiesintegerHome team league-record ties.
teams_home_league_record_pctcharacterHome team winning percentage.
venue_idintegerVenue ID.
venue_namecharacterVenue name.
venue_linkcharacterMLB Stats API relative venue link.
content_linkcharacterMLB Stats API relative game content link.
status_reasoncharacterReason for the game status, if any.
rescheduled_fromcharacterOriginal scheduled date-time if rescheduled.
rescheduled_from_datecharacterOriginal scheduled date if rescheduled.
resumed_fromcharacterOriginal date-time if the game was resumed.
resumed_from_datecharacterOriginal date if the game was resumed.
eventslistNested list of change events for the game.

Examples

# \donttest{
  try(mlb_game_changes(updated_since = "2021-08-10T19:08:24.000004Z", sport_id = 1))
#> ── MLB Game Changes data from MLB.com ─────────────── baseballr 2.0.0 ──
#>  Data updated: 2026-06-12 14:09:29 UTC
#> # A tibble: 1,000 × 69
#>    date      total_items total_events total_games total_games_in_progr…¹
#>    <chr>           <int>        <int>       <int>                  <int>
#>  1 1999-10-…           1            0           1                      0
#>  2 1999-10-…           1            0           1                      0
#>  3 1999-10-…           2            0           2                      0
#>  4 1999-10-…           2            0           2                      0
#>  5 1999-10-…           2            0           2                      0
#>  6 1999-10-…           2            0           2                      0
#>  7 1999-10-…           1            0           1                      0
#>  8 1999-10-…           1            0           1                      0
#>  9 1999-10-…           1            0           1                      0
#> 10 1999-10-…           1            0           1                      0
#> # ℹ 990 more rows
#> # ℹ abbreviated name: ¹​total_games_in_progress
#> # ℹ 64 more variables: game_pk <int>, game_guid <chr>, link <chr>,
#> #   game_type <chr>, season <chr>, game_date <chr>,
#> #   official_date <chr>, is_tie <lgl>, game_number <int>,
#> #   public_facing <lgl>, double_header <chr>, gameday_type <chr>,
#> #   tiebreaker <chr>, calendar_event_id <chr>, season_display <chr>, …
# }