Returns team or player season-long statistics standings from fotmob.com.
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
)
Three character country code. Can be one or multiple. If provided, `league_name` must also be provided (of the same length)
League names. If provided, `country` must also be provided (of the same length).
Fotmob ID for the league. Only used if `country` and `league_name` are not specified.
Season names in the format `"2021/2022"`. Multiple allowed. If multiple leagues are specified, season stats are retrieved for each league.
return statistics for either "team"
or "player"
. Can only be one or the other.
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"
"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.
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.
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.
returns a dataframe of team or player stats
if (FALSE) {
epl_team_xg_2021 <- fotmob_get_season_stats(
country = "ENG",
league_name = "Premier League",
season = "2020/2021",
stat_type = "Expected goals",
team_or_player = "team"
)
## fotmob doesn't has data for 2016/2017 for some leagues, but not all.
## you'll see a warning about this and receive an empty dataframe
get_epl_season_stats(
season = "2016/2017"
)
## Note that the `stat_type` name is slightly different.
epl_player_xg_2021 <- get_epl_season_stats(
country = "ENG",
league_name = "Premier League",
season = "2020/2021",
stat_type = "Expected goals (xG)",
team_or_player = "player"
)
}