Skip to contents

Acquire win probability for Major and Minor League games

Usage

mlb_game_wp(game_pk, timecode = NULL)

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
home_team_win_probabilitynumeric
away_team_win_probabilitynumeric
home_team_win_probability_addednumeric
at_bat_indexinteger
leverage_indexnumeric

Examples

# \donttest{
  try(mlb_game_wp(game_pk = 531060))
#> ── MLB Game Win Probability data from MLB.com ─────── baseballr 1.6.0 ──
#>  Data updated: 2024-04-13 21:56:18 UTC
#> # A tibble: 74 × 5
#>    home_team_win_probabi…¹ away_team_win_probab…² home_team_win_probab…³
#>                      <dbl>                  <dbl>                  <dbl>
#>  1                    52.2                   47.8                    2.2
#>  2                    53.7                   46.3                    1.5
#>  3                    52.5                   47.5                   -1.2
#>  4                    54.7                   45.3                    2.2
#>  5                    52.6                   47.4                   -2.1
#>  6                    51                     49                     -1.6
#>  7                    50                     50                     -1  
#>  8                    46.2                   53.8                   -3.8
#>  9                    49.7                   50.3                    3.5
#> 10                    52.6                   47.4                    2.9
#> # ℹ 64 more rows
#> # ℹ abbreviated names: ¹​home_team_win_probability,
#> #   ²​away_team_win_probability, ³​home_team_win_probability_added
#> # ℹ 2 more variables: at_bat_index <int>, leverage_index <dbl>
# }