team_match_multicomp: This function returns match-by-match metrics from the IQ API...

team_match_multicompR Documentation

This function returns match-by-match metrics from the IQ API for all teams across multiple leagues and/or seasons.

Description

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

Usage

team_match_multicomp(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, v4 and v5 are supported.

Value

df

Returns a data frame with all the per-match team metrics for the seasons and competitions specified.

Examples

comps <- competitions(username, password)
competitionmatrix = comps[,c(1,2,4,6)]
competitionmatrix <- competitionmatrix 
  filter(competition_name=="Serie A" | competition_name=="La Liga") 
  filter(season_name=="2024/2025"  ) 
 sbdata <-  team_match_multicomp(username = "insert_your_username", password = "insert_your_password",
                         competitionmatrix, version = "v1",
                         baseurl = "https://data.statsbombservices.com/api/", parallel = TRUE, cores = detectCores()) 

statsbomb/StatsBombR documentation built on Dec. 3, 2024, 11:53 p.m.