knitr::opts_chunk$set(echo = T, message = F, error = F, warning = F)
git_repo <- "systats/sportmonks" cat( badger::badge_custom("Premium", "Soccer Data", "yellow"), badger::badge_devel(git_repo, "blue"), #badge_travis(git_repo), #"[](https://codecov.io/gh/favstats/peRspective?branch=master)", badger::badge_code_size(git_repo), badger::badge_last_commit(git_repo) )
Install via
devtools::install_github("systats/sportmonks") library(sportmonks)
pacman::p_load(tidyverse, crayon) devtools::load_all() # devtools::document() # devtools::test() key <- jsonlite::read_json("tests/settings.json")[[1]] Sys.setenv(sportmonks = key) #Sys.getenv("sportmonks")
API responses are parsed per default. To get the raw json response, set the parse parameter to "F".
get_continents() get_continent(1)
get_countries() get_country(2)
my_leagues <- get_leagues(parse = T) # Default my_leagues_raw <- get_leagues(parse = F) my_leagues_raw %>% parse_request() my_leagues get_league(271)
new_leagues <- get_seasons() get_season(1273)
Depending on your substription plan and the situational needs you can include nested tables which is particuarly useful for the fixture Endpoint to get all the data at once.
includes <- c('localTeam','visitorTeam','goals', 'cards','lineup','referee','venue', 'odds', 'stats') get_fixture(id = 10333321, includes = includes) get_fixtures(ids = c(10333321, 10333322)) get_fixture(date = "2019-01-23") get_fixtures(dates = c("2019-01-01", "2019-02-01")) # missing: get by date range for team
get_live() # get_live_now() # all # inplay
get_comments(10333321)
get_highlights(10333321)
get_head2head(team1 = 309, team2 = 66)
get_team(180) get_team(season_id = 1273)
get_player(180)
get_topscores(season_id = 1273, agg = T)
get_venue(8928) # by id # by season id
get_round(round_id = 147767) get_round(season_id = 12963)
get_odds(10333321) # by fixture and bookmarker # by fixture and market # by fixture id # inplay odds by fixture id
get_coache(896462)
get_stage(stage_id = 7508262) get_stage(season_id = 12963)
get_bookmakers() get_bookmaker(book_id = 25679219)
get_markets() get_market(id = 10)
get_team_squads(season_id = 12963, team_id = 180)
get_tv(10333321)
sessionInfo()
get_future_games() get_future_games(league_id = 501) get_future_games(league_id = c(271, 501))
default
all our plans are included with 2000 requests per 60 minutes per endpoint.Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.