Learn R Programming

baseballr (version 0.8.6)

get_pbp_mlb: Acquire pitch-by-pitch data for Major and Minor League games via the MLB api http://statsapi.mlb.com/api/

Description

Acquire pitch-by-pitch data for Major and Minor League games via the MLB api http://statsapi.mlb.com/api/

Usage

get_pbp_mlb(game_pk)

Arguments

game_pk

The date for which you want to find game_pk values for MLB games

Value

Returns a data frame 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 availble 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.

Examples

Run this code
# NOT RUN {
get_pbp_mlb(575156)
# }

Run the code above in your browser using DataLab