fotmob_get_league_tables: Get standings from fotmob

View source: R/fotmob_leagues.R

fotmob_get_league_tablesR Documentation

Get standings from fotmob

Description

Returns league standings from fotmob.com. 3 types are returned: all, home, away

Usage

fotmob_get_league_tables(country, league_name, league_id, cached = TRUE)

Arguments

country

Three character country code. Can be one or multiple. If provided, 'league_name' must also be provided (of the same length)

league_name

League names. If provided, 'country' must also be provided (of the same length).

league_id

Fotmob ID for the league. Only used if 'country' and 'league_name' are not specified.

cached

Whether to load the dataframe from the data CSV. This is faster and most likely what you want to do, unless you identify a league that's being tracked by fotmob that's not in this pre-saved CSV.

Value

returns a dataframe of league standings

Examples


try({
library(dplyr)
library(tidyr)

# one league
fotmob_get_league_tables(
  country = "ENG",
  league_name = "Premier League"
)

# one league, by id
fotmob_get_league_tables(
  league_id = 47
)

# multiple leagues (could also use ids)
league_tables <- fotmob_get_league_tables(
  country =     c("ENG",            "ESP"   ),
  league_name = c("Premier League", "LaLiga")
)

# look at tables if only away matches are considered
league_tables %>%
  dplyr::filter(table_type == "away")
})


worldfootballR documentation built on Nov. 26, 2022, 9:05 a.m.