mlb_pbp {baseballr} | R Documentation |
Acquire pitch-by-pitch data for Major and Minor League games
Description
Acquire pitch-by-pitch data for Major and Minor League games
Usage
mlb_pbp(game_pk)
Arguments
game_pk |
The date for which you want to find game_pk values for MLB games |
Value
Returns a tibble that includes over 100 columns of data provided by the MLB Stats API at a pitch level.
Some data will vary depending on the park and the league level, as most sensor data is not available in minor league parks via this API. Note that the column names have mostly been left as-is and there are likely duplicate columns in terms of the information they provide. I plan to clean the output up down the road, but for now I am leaving the majority as-is.
Both major and minor league pitch-by-pitch data can be pulled with this function.
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 |
isBaseRunningPlay | logical |
isSubstitution | logical |
about.isTopInning | logical |
matchup.postOnFirst.id | integer |
matchup.postOnFirst.fullName | character |
matchup.postOnFirst.link | character |
matchup.postOnSecond.id | integer |
matchup.postOnSecond.fullName | character |
matchup.postOnSecond.link | character |
matchup.postOnThird.id | integer |
matchup.postOnThird.fullName | character |
matchup.postOnThird.link | character |
Examples
try(mlb_pbp(game_pk = 632970))
[Package baseballr version 1.6.0 Index]