fotmob_get_season_stats {worldfootballR} | R 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 |
stat_name |
the type of statistic. Can be more than one.
'stat_name' must be one of the following for
For
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"
)
})