Skip to contents

Get MLB win probability chart data from ESPN

Usage

espn_mlb_wp(game_id)

Arguments

game_id

(Integer required): Game ID filter for querying a single game

Value

espn_mlb_wp() - A baseballr_data tibble, one row per win-probability play:

col_nametypesdescription
game_idnumericUnique ESPN game/event identifier.
play_idcharacterUnique play identifier within the game.
home_win_percentagenumericHome team win probability (0-1 decimal).
away_win_percentagenumericAway team win probability (0-1 decimal).
tie_percentagenumericTie probability (0-1 decimal; extra-innings tie state).
sequence_numbercharacterSequence number of the play within the game.
textcharacterText description of the play.
away_scoreintegerAway team run total after the play.
home_scoreintegerHome team run total after the play.
scoring_playlogicalTRUE if the play scored a run.
score_valueintegerRuns scored on the play.
wallclockcharacterWall-clock timestamp of the play (ISO 8601).
at_bat_idcharacterIdentifier of the at-bat the play belongs to.
summary_typecharacterPlay summary type.
outsintegerOuts in the inning after the play.
participantslistList of athlete participants in the play.
type_idcharacterPlay type identifier.
type_textcharacterPlay type description.
type_typecharacterPlay type category.
period_typecharacterPeriod type ('inning').
period_numberintegerInning number.
period_display_valuecharacterInning display value (e.g. 'Top 1st').
team_idcharacterBatting team identifier.
pitch_count_ballsintegerBalls in the count when the pitch was thrown.
pitch_count_strikesintegerStrikes in the count when the pitch was thrown.
result_count_ballsintegerBalls in the count after the pitch.
result_count_strikesintegerStrikes in the count after the pitch.
bat_orderintegerBatting order spot of the batter.
type_alternative_textcharacterAlternative play type text.
bats_typecharacterBatter handedness type.
bats_abbreviationcharacterBatter handedness (L/R/S).
bats_display_valuecharacterBatter handedness display value.
at_bat_pitch_numberintegerPitch number within the at-bat.
pitch_velocityintegerPitch velocity (mph).
trajectorycharacterBatted-ball trajectory.
type_abbreviationcharacterPlay type abbreviation.
pitch_coordinate_xintegerPitch location x-coordinate.
pitch_coordinate_yintegerPitch location y-coordinate.
pitch_type_idcharacterPitch type identifier.
pitch_type_textcharacterPitch type description.
pitch_type_abbreviationcharacterPitch type abbreviation.
hit_coordinate_xintegerBatted-ball location x-coordinate.
hit_coordinate_yintegerBatted-ball location y-coordinate.
alternative_playcharacterAlternative play flag.
alternative_type_idcharacterAlternative play type id.
alternative_type_textcharacterAlternative play type text.
alternative_type_abbreviationcharacterAlternative play type abbreviation.
alternative_type_alternative_textcharacterAlternative play alternative text.
alternative_type_typecharacterAlternative play type category.
on_first_athlete_idcharacterAthlete id of the runner on first base.
on_second_athlete_idcharacterAthlete id of the runner on second base.
on_third_athlete_idcharacterAthlete id of the runner on third base.

See also

Other ESPN MLB Functions: espn_mlb, espn_mlb_athletes_index(), espn_mlb_award(), espn_mlb_betting(), espn_mlb_calendar(), espn_mlb_coach(), espn_mlb_coach_record(), espn_mlb_coach_season(), espn_mlb_coaches(), espn_mlb_conferences(), espn_mlb_draft(), espn_mlb_draft_athlete_detail(), espn_mlb_draft_athletes(), espn_mlb_draft_pick(), espn_mlb_draft_rounds(), espn_mlb_draft_status(), espn_mlb_franchise(), espn_mlb_franchises(), espn_mlb_freeagents(), espn_mlb_futures(), espn_mlb_game_all(), espn_mlb_game_broadcasts(), espn_mlb_game_endpoints, espn_mlb_game_info(), espn_mlb_game_odds(), espn_mlb_game_official_detail(), espn_mlb_game_officials(), espn_mlb_game_play(), espn_mlb_game_play_personnel(), espn_mlb_game_player_box(), espn_mlb_game_powerindex(), espn_mlb_game_predictor(), espn_mlb_game_probabilities(), espn_mlb_game_probables(), espn_mlb_game_propbets(), espn_mlb_game_rosters(), espn_mlb_game_situation(), espn_mlb_game_team_leaders(), espn_mlb_game_team_linescores(), espn_mlb_game_team_records(), espn_mlb_game_team_roster(), espn_mlb_game_team_roster_entry(), espn_mlb_game_team_score(), espn_mlb_game_team_statistics(), espn_mlb_injuries(), espn_mlb_leaders(), espn_mlb_news(), espn_mlb_pbp(), espn_mlb_player_awards(), espn_mlb_player_box(), espn_mlb_player_career_stats(), espn_mlb_player_contract(), espn_mlb_player_contracts(), espn_mlb_player_endpoints, espn_mlb_player_eventlog(), espn_mlb_player_eventlog_v2(), espn_mlb_player_gamelog(), espn_mlb_player_info(), espn_mlb_player_overview(), espn_mlb_player_seasons(), espn_mlb_player_splits(), espn_mlb_player_statisticslog(), espn_mlb_player_stats(), espn_mlb_player_stats_v3(), espn_mlb_position(), espn_mlb_positions(), espn_mlb_powerindex(), espn_mlb_scoreboard(), espn_mlb_season_awards(), espn_mlb_season_draft(), espn_mlb_season_group(), espn_mlb_season_group_children(), espn_mlb_season_group_teams(), espn_mlb_season_groups(), espn_mlb_season_info(), espn_mlb_season_leaders(), espn_mlb_season_ranking(), espn_mlb_season_rankings(), espn_mlb_season_type(), espn_mlb_season_types(), espn_mlb_season_week(), espn_mlb_season_weeks(), espn_mlb_seasons(), espn_mlb_standings(), espn_mlb_team(), espn_mlb_team_box(), espn_mlb_team_current_roster(), espn_mlb_team_depthchart(), espn_mlb_team_endpoints, espn_mlb_team_injuries(), espn_mlb_team_leaders(), espn_mlb_team_news(), espn_mlb_team_odds_records(), espn_mlb_team_record(), espn_mlb_team_record_detail(), espn_mlb_team_roster(), espn_mlb_team_schedule(), espn_mlb_team_season_profile(), espn_mlb_team_season_roster(), espn_mlb_team_season_statistics(), espn_mlb_team_stats(), espn_mlb_teams(), espn_mlb_tournament(), espn_mlb_tournament_season(), espn_mlb_tournament_seasons(), espn_mlb_tournaments(), espn_mlb_transactions(), espn_mlb_venues(), espn_mlb_week_ranking(), espn_mlb_week_rankings()

Examples

# \donttest{
espn_mlb_wp(game_id = 401283399)
#>  2026-06-08 11:08:12.166211: game_id '401283399' invalid or no ESPN win probability data available!
#>  Args: game_id = 401283399
#>  Error: `clean_names()` requires that either names or dimnames be non-null.
#> $code
#> [1] 404
#> 
#> $message
#> [1] "Error invoking GET: http://sports.core.api.espn.pvt/v2/sports/baseball/leagues/mlb/events/401283399/competitions/401283399/status, status=404, duration=6 ms, message=null, cache=CACHE_MISS"
#> 
# }