fotmob_get_season_stats: Get season statistics from fotmob

View source: R/fotmob_stats.R

fotmob_get_season_statsR Documentation

Get season statistics from fotmob

Description

Returns team or player season-long statistics standings from fotmob.com.

Usage

fotmob_get_season_stats(
  country,
  league_name,
  league_id,
  season_name,
  team_or_player = c("team", "player"),
  stat_name,
  stat_league_name = league_name,
  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.

season_name

Season names in the format '"2021/2022"'. Multiple allowed. If multiple leagues are specified, season stats are retrieved for each league.

team_or_player

return statistics for either "team" or "player". Can only be one or the other.

stat_name

the type of statistic. Can be more than one. 'stat_name' must be one of the following for "player":

  • Accurate long balls per 90

  • Accurate passes per 90

  • Assists

  • Big chances created

  • Big chances missed

  • Blocks per 90

  • Chances created

  • Clean sheets

  • Clearances per 90

  • Expected assist (xA)

  • Expected assist (xA) per 90

  • Expected goals (xG)

  • Expected goals (xG) per 90

  • Expected goals on target (xGOT)

  • FotMob rating

  • Fouls committed per 90

  • Goals + Assists

  • Goals conceded per 90

  • Goals per 90

  • Goals prevented

  • Interceptions per 90

  • Penalties conceded

  • Penalties won

  • Possession won final 3rd per 90

  • Red cards

  • Save percentage

  • Saves per 90

  • Shots on target per 90

  • Shots per 90

  • Successful dribbles per 90

  • Successful tackles per 90

  • Top scorer

  • xG + xA per 90

  • Yellow cards

For "team", 'stat_name' must be one of the following:

  • Accurate crosses per match

  • Accurate long balls per match

  • Accurate passes per match

  • Average possession

  • Big chances created

  • Big chances missed

  • Clean sheets

  • Clearances per match

  • Expected goals

  • FotMob rating

  • Fouls per match

  • Goals conceded per match

  • Goals per match

  • Interceptions per match

  • Penalties awarded

  • Penalties conceded

  • Possession won final 3rd per match

  • Red cards

  • Saves per match

  • Shots on target per match

  • Successful tackles per match

  • xG conceded

  • Yellow cards

Fotmob has changed these stat names over time, so this list may be out-dated. If you try an invalid stat name, you should see an error message indicating which ones are available.

stat_league_name

Same format as 'league_name'. If not provided explicitly, then it takes on the same value as 'league_name'. If provided explicitly, should be of the same length as 'league_name' (or 'league_id' if 'league_name' is not provided).

Note that not Fotmob currently only goes back as far as '"2016/2017"'. Some leagues may not have data for that far back.

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 team or player stats

Examples


try({
epl_team_xg_2021 <- fotmob_get_season_stats(
  country = "ENG",
  league_name = "Premier League",
  season = "2020/2021",
  stat_name = "Expected goals",
  team_or_player = "team"
)
})


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