Learn R Programming

StatsBombR (version 0.1.0)

get.matches: This function returns all matches from the specified season and competition.

Description

For use with the StatsBomb Data API credentials. This function is used to access the JSON file from the StatsBomb API and return the matches in vector form. For reference, the premier league has a competition id = 2 and 2018 is season_id = 1. We apologize for the confusing nature of having a get.matches that returns all of the matches in a competition and the function get.match which returns all of the events in a match.

Usage

get.matches(username = "username", password = "password",
            season_id = "season_id", competition_id = "competition_id", version = "v1",
            baseurl = "https://data.statsbombservices.com/api/",
            remove.deleted.matches = TRUE)

Arguments

username

Character object of your StatsBomb API username.

password

Character object of your StatsBomb API password.

season_id

Character object of the season_id for the matches you wish to access.

competition_id

Character object of the competition_id for the match you wish to access.

version

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

remove.deleted.matches

Boolean variable for whether or not you want the deleted matches to be removed from the returned data frame.

Value

df

Returns a dataframe with all matches for the specified season and competition.

Examples

Run this code
# NOT RUN {
get.matches(username = "username", password = "password",
            season_id = "season_id", competition_id = "competition_id", version = "v1",
            baseurl = "https://data.statsbombservices.com/api/")
# }

Run the code above in your browser using DataLab