Skip to content

Instantly share code, notes, and snippets.

@JoGall
Last active December 7, 2018 12:30
Show Gist options
  • Save JoGall/f2d035bad4449b3526c285cb02e44fdb to your computer and use it in GitHub Desktop.
Save JoGall/f2d035bad4449b3526c285cb02e44fdb to your computer and use it in GitHub Desktop.
#devtools::install_github("statsbomb/StatsBombR") #install package
#devtools::install_github("jogall/StatsBombR") #or fork for R v<5.0 if necessary
library(StatsBombR)
# see all free competitions
FreeCompetitions()
# e.g. get all fixtures from FIFA World Cup
fixtures <- FreeMatches(43)
# get all events for fixtures
dat <- lapply(1:nrow(fixtures), function(i) {
temp <- get.matchFree(fixtures[i, ])
Sys.sleep(runif(1, 1, 2)) # be courteous!
allclean(temp)
}) %>%
plyr::rbind.fill()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment