MultiCompEvents: This function returns all events from the competitions and...

Description Usage Arguments Value Examples

View source: R/MultiCompEvents.R

Description

For use with the StatsBomb Data API credentials. This function is used to access the JSON file from the StatsBomb API and format it as a data frame (tibble) for use in R. This function supports multiple competitions and seasons simultaneously. Currently, parallel is only supported for windows.

Usage

1
2
3
MultiCompEvents(username = "username", password = "password",
                competitionmatrix, version = "v1",
                baseurl = "https://data.statsbombservices.com/api/", parallel = TRUE, cores = detectCores())

Arguments

username

Character object of your StatsBomb API username.

password

Character object of your StatsBomb API password.

competitionmatrix

Matrix of the competition and season ids you want the events for. Competition ID in the first column and Season ID in the second column.

version

Character string of the version of the StatsBomb API you wish to access. Currently version v1, v2, v3 and v4 are supported.

Value

df

Returns a data frame with all events for the events and seasons specified.

Examples

1
2
3
4
5
6
7
8
##Pull Competitions From the API
comps <- competitions(username, password)
##Filter for the competitions you want
EuropeComps <- comps 
##Create a matrix of the competition and season ids
competitionmatrix <- as.matrix(EuropeComps[,1:2])
##Pull all of the events.
Events <- MultiCompEvents(username, password, competitionmatrix)

nandomartinez/Soccer documentation built on Nov. 4, 2019, 8:34 p.m.