cpsievert / pitchRx

Tools for scraping MLB Gameday data and Visualizing PITCHf/x
http://cpsievert.github.io/pitchRx/
Other
124 stars 33 forks source link

Fix issue 25: Enabled Scrape function for Minor League Data #48

Closed keberwein closed 7 years ago

keberwein commented 7 years ago

https://github.com/cpsievert/pitchRx/issues/25

I split the gameDir into MLB.gids and nonMLB.gids. Then used nested if statements to decide which scrape method to apply. We can now scrape MLB and minor leagues (even in the same gid list.)

I tested all the following and they are working:

devtools::install_github("keberwein/pitchRx", force=T)
library(pitchRx)

# Example from the documentation.
data(nonMLBgids, package = "pitchRx")
aaa <- nonMLBgids[grepl("2011_06_01_[a-z]{3}aaa_[a-z]{3}aaa", nonMLBgids)]
dat <- scrape(game.ids = aaa)

# Example of non-MLB gids.
mixed_gids <- scrape(game.ids=c("gid_2010_06_01_lhvaaa_tolaaa_1", "gid_2010_06_02_albaaa_nasaaa_1"))

# Traditional usage behaves as expeted.
dat <- scrape(start = "2013-08-01", end = "2013-08-01")