Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Scrape 2017 Statcast data from Baseball Savant using baseballr package
library(baseballr)
library(readr)
s1 <- scrape_statcast_savant_batter_all("2017-04-02",
"2017-04-08")
s2 <- scrape_statcast_savant_batter_all("2017-04-09",
"2017-04-15")
s3 <- scrape_statcast_savant_batter_all("2017-04-16",
"2017-04-22")
s4 <- scrape_statcast_savant_batter_all("2017-04-23",
"2017-04-29")
s5 <- scrape_statcast_savant_batter_all("2017-04-30",
"2017-05-06")
s6 <- scrape_statcast_savant_batter_all("2017-05-07",
"2017-05-13")
s7 <- scrape_statcast_savant_batter_all("2017-05-14",
"2017-05-20")
s8 <- scrape_statcast_savant_batter_all("2017-05-21",
"2017-05-27")
s9 <- scrape_statcast_savant_batter_all("2017-05-28",
"2017-06-03")
s10 <- scrape_statcast_savant_batter_all("2017-06-04",
"2017-06-10")
s11 <- scrape_statcast_savant_batter_all("2017-06-11",
"2017-06-17")
s12 <- scrape_statcast_savant_batter_all("2017-06-18",
"2017-06-24")
s13 <- scrape_statcast_savant_batter_all("2017-06-25",
"2017-07-01")
s14 <- scrape_statcast_savant_batter_all("2017-07-02",
"2017-07-08")
s15 <- scrape_statcast_savant_batter_all("2017-07-09",
"2017-07-15")
s16 <- scrape_statcast_savant_batter_all("2017-07-16",
"2017-07-22")
s17 <- scrape_statcast_savant_batter_all("2017-07-23",
"2017-07-29")
s18 <- scrape_statcast_savant_batter_all("2017-07-30",
"2017-08-05")
s19 <- scrape_statcast_savant_batter_all("2017-08-06",
"2017-08-12")
s20 <- scrape_statcast_savant_batter_all("2017-08-13",
"2017-08-19")
s21 <- scrape_statcast_savant_batter_all("2017-08-20",
"2017-08-26")
s22 <- scrape_statcast_savant_batter_all("2017-08-27",
"2017-09-02")
s23 <- scrape_statcast_savant_batter_all("2017-09-03",
"2017-09-09")
s24 <- scrape_statcast_savant_batter_all("2017-09-10",
"2017-09-16")
s25 <- scrape_statcast_savant_batter_all("2017-09-17",
"2017-09-23")
s26 <- scrape_statcast_savant_batter_all("2017-09-24",
"2017-09-30")
s27 <- scrape_statcast_savant_batter_all("2017-10-01",
"2017-11-01")
sc1 <- rbind(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10,
s11, s12, s13, s14)
sc2 <- rbind(s15, s16, s17, s18, s19, s20, s21,
s22, s23, s24, s25, s26, s27)
sc_all <- rbind(sc1, sc2)
write_csv(sc_all, "statcast2017.csv")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.