Skip to contents

Acquire game context metrics for Major and Minor League games

Usage

mlb_game_context_metrics(game_pk, timecode)

Arguments

game_pk

The game_pk for the game requested

timecode

The time code for the MLB game (format: MMDDYYYY_HHMMSS)

Value

Returns a tibble that includes time codes from the game_pk requested

col_nametypes
game_pkinteger
linkcharacter
game_typecharacter
seasoncharacter
game_datecharacter
official_datecharacter
status_abstract_game_statecharacter
status_coded_game_statecharacter
status_detailed_statecharacter
status_status_codecharacter
status_start_time_tbdlogical
status_abstract_game_codecharacter
teams_away_league_record_winsinteger
teams_away_league_record_lossesinteger
teams_away_league_record_pctcharacter
teams_away_scoreinteger
teams_away_team_idinteger
teams_away_team_namecharacter
teams_away_team_linkcharacter
teams_away_is_winnerlogical
teams_away_probable_pitcher_idinteger
teams_away_probable_pitcher_full_namecharacter
teams_away_probable_pitcher_linkcharacter
teams_away_split_squadlogical
teams_away_series_numberinteger
teams_home_league_record_winsinteger
teams_home_league_record_lossesinteger
teams_home_league_record_pctcharacter
teams_home_scoreinteger
teams_home_team_idinteger
teams_home_team_namecharacter
teams_home_team_linkcharacter
teams_home_is_winnerlogical
teams_home_probable_pitcher_idinteger
teams_home_probable_pitcher_full_namecharacter
teams_home_probable_pitcher_linkcharacter
teams_home_split_squadlogical
teams_home_series_numberinteger
venue_idinteger
venue_namecharacter
venue_linkcharacter
link_1character
is_tielogical
game_numberinteger
public_facinglogical
double_headercharacter
gameday_typecharacter
tiebreakercharacter
calendar_event_idcharacter
season_displaycharacter
day_nightcharacter
scheduled_inningsinteger
reverse_home_away_statuslogical
inning_break_lengthinteger
games_in_seriesinteger
series_game_numberinteger
series_descriptioncharacter
record_sourcecharacter
if_necessarycharacter
if_necessary_descriptioncharacter
game_idcharacter
home_win_probabilitynumeric
away_win_probabilitynumeric

Examples

# \donttest{
  try(mlb_game_context_metrics(game_pk = 531060, timecode = "20180803_182458"))
#> ── MLB Game Context Metrics data from MLB.com ─────── baseballr 1.6.0 ──
#>  Data updated: 2024-04-13 21:56:14 UTC
#> # A tibble: 1 × 64
#>   game_pk game_guid       link  game_type season game_date official_date
#>     <int> <chr>           <chr> <chr>     <chr>  <chr>     <chr>        
#> 1  531060 053ddbf2-26e1-… /api… R         2018   2018-08-… 2018-08-03   
#> # ℹ 57 more variables: status_abstract_game_state <chr>,
#> #   status_coded_game_state <chr>, status_detailed_state <chr>,
#> #   status_status_code <chr>, status_start_time_tbd <lgl>,
#> #   status_abstract_game_code <chr>,
#> #   teams_away_league_record_wins <int>,
#> #   teams_away_league_record_losses <int>,
#> #   teams_away_league_record_pct <chr>, teams_away_score <int>, …
# }