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.2.0 ──
#>  Data updated: 2022-04-30 07:16:03 UTC
#> # A tibble: 74 × 5
#>    home_team_win_probabi… away_team_win_p… home_team_win_p… at_bat_index
#>                     <dbl>            <dbl>            <dbl>        <int>
#>  1                   52.2             47.8              2.2            0
#>  2                   53.7             46.3              1.5            1
#>  3                   52.5             47.5             -1.2            2
#>  4                   54.7             45.3              2.2            3
#>  5                   52.6             47.4             -2.1            4
#>  6                   51               49               -1.6            5
#>  7                   50               50               -1              6
#>  8                   46.2             53.8             -3.8            7
#>  9                   49.7             50.3              3.5            8
#> 10                   52.6             47.4              2.9            9
#> # … with 64 more rows, and 1 more variable: leverage_index <dbl>
# }