Get ESPN MLB PBP data
Value
A play-by-play data frame.
| col_name | types | description |
| id | character | Play / record identifier. |
| sequence_number | character | Play sequence number within the game. |
| text | character | Text description of the play. |
| away_score | integer | Away team run total after the play. |
| home_score | integer | Home team run total after the play. |
| scoring_play | logical | TRUE if the play scored a run. |
| score_value | integer | Runs scored on the play. |
| wallclock | character | Wall-clock timestamp of the play (ISO 8601). |
| at_bat_id | character | Identifier of the at-bat the play belongs to. |
| summary_type | character | Play summary type. |
| outs | integer | Outs in the inning after the play. |
| type | character | Type. |
| bat_order | integer | Spot in the batting order (1-9; NA if not applicable). |
| at_bat_pitch_number | integer | Pitch number within the at-bat. |
| pitch_velocity | integer | Pitch velocity (mph). |
| trajectory | character | Batted-ball trajectory. |
| alternative_play | character | Alternative play. |
| type_id | integer | Type id. |
| type_text | character | Type text. |
| type_type | character | Type type. |
| type_alternative_text | character | Type alternative text. |
| type_abbreviation | character | Type abbreviation. |
| period_type | character | Period type ('inning'). |
| period_number | integer | Inning number. |
| period_display_value | character | Inning display value (e.g. 'Top 1st'). |
| team_id | integer | Unique ESPN team identifier. |
| pitch_count_balls | integer | Balls in the count when the pitch was thrown. |
| pitch_count_strikes | integer | Strikes in the count when the pitch was thrown. |
| result_count_balls | integer | Balls in the count after the pitch. |
| result_count_strikes | integer | Strikes in the count after the pitch. |
| bats_type | character | Bats type. |
| bats_abbreviation | character | Bats abbreviation. |
| bats_display_value | character | Bats display value. |
| pitch_coordinate_x | integer | Pitch location x-coordinate. |
| pitch_coordinate_y | integer | Pitch location y-coordinate. |
| pitch_type_id | character | Pitch type identifier. |
| pitch_type_text | character | Pitch type description (e.g. 'Four-seam FB'). |
| pitch_type_abbreviation | character | Pitch type abbreviation. |
| hit_coordinate_x | integer | Batted-ball location x-coordinate. |
| hit_coordinate_y | integer | Batted-ball location y-coordinate. |
| alternative_type_id | character | Alternative type id. |
| alternative_type_text | character | Alternative type text. |
| alternative_type_abbreviation | character | Alternative type abbreviation. |
| alternative_type_alternative_text | character | Alternative type alternative text. |
| alternative_type_type | character | Alternative type type. |
| on_first_athlete_id | character | Athlete id of the runner on first base. |
| on_second_athlete_id | character | Athlete id of the runner on second base. |
| play_id | character | Play id. |
| athlete_id_1 | integer | Primary participating athlete id (batter). |
| athlete_id_2 | integer | Second participating athlete id (pitcher). |
| athlete_id_3 | integer | Third participating athlete id (fielder). |
| home_team_id | integer | Home team id. |
| home_team_mascot | character | Home team mascot. |
| home_team_name | character | Home team name. |
| home_team_abbrev | character | Home team abbrev. |
| home_team_logo | character | Home team logo. |
| home_team_logo_dark | character | Home team logo dark. |
| home_team_full_name | character | Home team full name. |
| home_team_color | character | Home team color. |
| home_team_alternate_color | character | Home team alternate color. |
| home_team_score | integer | Home team score. |
| home_team_winner | logical | Home team winner. |
| home_team_record | character | Home team record. |
| away_team_id | integer | Away team id. |
| away_team_mascot | character | Away team mascot. |
| away_team_name | character | Away team name. |
| away_team_abbrev | character | Away team abbrev. |
| away_team_logo | character | Away team logo. |
| away_team_logo_dark | character | Away team logo dark. |
| away_team_full_name | character | Away team full name. |
| away_team_color | character | Away team color. |
| away_team_alternate_color | character | Away team alternate color. |
| away_team_score | integer | Away team score. |
| away_team_winner | logical | Away team winner. |
| away_team_record | character | Away team record. |
| game_id | integer | Unique ESPN game/event identifier. |
| season | integer | Season (4-digit year). |
| season_type | integer | ESPN season type (1=pre, 2=regular, 3=postseason, 4=off-season). |
| game_date | Date | Game date (YYYY-MM-DD). |
| game_date_time | POSIXct | Game start date/time (US/Eastern). |
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_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(),
espn_mlb_wp()
Examples
# \donttest{
try(espn_mlb_pbp(game_id = 401071880))
#> ✖ 2026-06-08 11:07:48.37598: Invalid arguments or no play-by-play data for 401071880 available!
#> ✖ Args: game_id = 401071880
#> ✖ Error: The API returned an error, HTTP Response Code 404
#> NULL
# }
