Acquire pitch-by-pitch data between two timecodes for Major and Minor League games
mlb_pbp_diff(game_pk, start_timecode, end_timecode)
Returns a tibble that includes over 100 columns of data provided by the MLB Stats API at a pitch level between the start_timecode and end_timecode
col_name | types |
game_pk | numeric |
game_date | character |
index | integer |
startTime | character |
endTime | character |
isPitch | logical |
type | character |
playId | character |
pitchNumber | integer |
details.description | character |
details.event | character |
details.awayScore | integer |
details.homeScore | integer |
details.isScoringPlay | logical |
details.hasReview | logical |
details.code | character |
details.ballColor | character |
details.isInPlay | logical |
details.isStrike | logical |
details.isBall | logical |
details.call.code | character |
details.call.description | character |
count.balls.start | integer |
count.strikes.start | integer |
count.outs.start | integer |
player.id | integer |
player.link | character |
pitchData.strikeZoneTop | numeric |
pitchData.strikeZoneBottom | numeric |
details.fromCatcher | logical |
pitchData.coordinates.x | numeric |
pitchData.coordinates.y | numeric |
hitData.trajectory | character |
hitData.hardness | character |
hitData.location | character |
hitData.coordinates.coordX | numeric |
hitData.coordinates.coordY | numeric |
actionPlayId | character |
details.eventType | character |
details.runnerGoing | logical |
position.code | character |
position.name | character |
position.type | character |
position.abbreviation | character |
battingOrder | character |
atBatIndex | character |
result.type | character |
result.event | character |
result.eventType | character |
result.description | character |
result.rbi | integer |
result.awayScore | integer |
result.homeScore | integer |
about.atBatIndex | integer |
about.halfInning | character |
about.inning | integer |
about.startTime | character |
about.endTime | character |
about.isComplete | logical |
about.isScoringPlay | logical |
about.hasReview | logical |
about.hasOut | logical |
about.captivatingIndex | integer |
count.balls.end | integer |
count.strikes.end | integer |
count.outs.end | integer |
matchup.batter.id | integer |
matchup.batter.fullName | character |
matchup.batter.link | character |
matchup.batSide.code | character |
matchup.batSide.description | character |
matchup.pitcher.id | integer |
matchup.pitcher.fullName | character |
matchup.pitcher.link | character |
matchup.pitchHand.code | character |
matchup.pitchHand.description | character |
matchup.splits.batter | character |
matchup.splits.pitcher | character |
matchup.splits.menOnBase | character |
batted.ball.result | factor |
home_team | character |
home_level_id | integer |
home_level_name | character |
home_parentOrg_id | integer |
home_parentOrg_name | character |
home_league_id | integer |
home_league_name | character |
away_team | character |
away_level_id | integer |
away_level_name | character |
away_parentOrg_id | integer |
away_parentOrg_name | character |
away_league_id | integer |
away_league_name | character |
batting_team | character |
fielding_team | character |
last.pitch.of.ab | character |
pfxId | character |
details.trailColor | character |
details.type.code | character |
details.type.description | character |
pitchData.startSpeed | numeric |
pitchData.endSpeed | numeric |
pitchData.zone | integer |
pitchData.typeConfidence | numeric |
pitchData.plateTime | numeric |
pitchData.extension | numeric |
pitchData.coordinates.aY | numeric |
pitchData.coordinates.aZ | numeric |
pitchData.coordinates.pfxX | numeric |
pitchData.coordinates.pfxZ | numeric |
pitchData.coordinates.pX | numeric |
pitchData.coordinates.pZ | numeric |
pitchData.coordinates.vX0 | numeric |
pitchData.coordinates.vY0 | numeric |
pitchData.coordinates.vZ0 | numeric |
pitchData.coordinates.x0 | numeric |
pitchData.coordinates.y0 | numeric |
pitchData.coordinates.z0 | numeric |
pitchData.coordinates.aX | numeric |
pitchData.breaks.breakAngle | numeric |
pitchData.breaks.breakLength | numeric |
pitchData.breaks.breakY | numeric |
pitchData.breaks.spinRate | integer |
pitchData.breaks.spinDirection | integer |
hitData.launchSpeed | numeric |
hitData.launchAngle | numeric |
hitData.totalDistance | numeric |
injuryType | character |
umpire.id | integer |
umpire.link | character |
about.isTopInning | logical |
matchup.postOnFirst.id | integer |
matchup.postOnFirst.fullName | character |
matchup.postOnFirst.link | character |
The date for which you want to find game_pk values for MLB games
The start time code for the MLB game (format: MMDDYYYY_HHMMSS)
The end time code for the MLB game (format: MMDDYYYY_HHMMSS)
# \donttest{
try(mlb_pbp_diff(game_pk = 632970,
start_timecode = "20210808_231704",
end_timecode = "20210808_233711"))
# }
Run the code above in your browser using DataLab