Skip to contents

Download data from all regular season MLB games within a specified date range.

Usage

download_statsapi(
  start_date,
  end_date,
  level = c("mlb", "aaa"),
  game_type = "R",
  cl = NULL
)

Arguments

start_date

first date included in the download

end_date

last date included in the download

level

character string, "mlb" (default) or "aaa"

game_type

character vector of game types to include. Options are "R" (regular sesason), "F" (first-round playoff series, aka wild card), "D" (division series), "L" (league championship series), "W" (world series), "S" (spring training), "A" (all-star game), "E" (exhibition). Default is "R".

cl

optional cluster object for parallel computation, default is NULL (not parallel)

Value

a list of four dataframes: event, pitch, play and game

Examples

if (FALSE) { # \dontrun{
   data_statsapi <- download_statsapi(
     start_date = "2024-07-01",
     end_date = "2024-07-01"
   )
} # }