Closed zOFsky closed 10 months ago
There is currently no function to extract card information directly from fotmob, but I can look into making a function for it. (One place it is stored at is the content/matchFacts/events
element in the match JSON.)
In the meantime, you can get it from FBref with fb_advanced_match_stats()
.
library(worldfootballR)
misc <- fb_advanced_match_stats(
'https://fbref.com/en/matches/96f5ee84/Newcastle-United-Aston-Villa-October-29-2022-Premier-League',
stat_type = 'misc',
team_or_player = 'player'
)
dplyr::glimpse(misc)
#> Rows: 33
#> Columns: 42
#> $ League <chr> "Premier League", "Premier League", "Premier …
#> $ Match_Date <chr> "2022-10-29", "2022-10-29", "2022-10-29", "20…
#> $ Matchweek <chr> "Premier League (Matchweek 14)", "Premier Lea…
#> $ Home_Team <chr> "Newcastle United", "Newcastle United", "Newc…
#> $ Home_Formation <chr> "4-3-3", "4-3-3", "4-3-3", "4-3-3", "4-3-3", …
#> $ Home_Score <dbl> 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, …
#> $ Home_xG <dbl> 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, …
#> $ Home_Goals <chr> "Callum Wilson (P) · 45+6’ Callum Wils…
#> $ Home_Yellow_Cards <chr> "1", "1", "1", "1", "1", "1", "1", "1", "1", …
#> $ Home_Red_Cards <chr> "0", "0", "0", "0", "0", "0", "0", "0", "0", …
#> $ Away_Team <chr> "Aston Villa", "Aston Villa", "Aston Villa", …
#> $ Away_Formation <chr> "4-2-3-1", "4-2-3-1", "4-2-3-1", "4-2-3-1", "…
#> $ Away_Score <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
#> $ Away_xG <dbl> 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, …
#> $ Away_Goals <chr> "", "", "", "", "", "", "", "", "", "", "", "…
#> $ Away_Yellow_Cards <chr> "1", "1", "1", "1", "1", "1", "1", "1", "1", …
#> $ Away_Red_Cards <chr> "0", "0", "0", "0", "0", "0", "0", "0", "0", …
#> $ Game_URL <chr> "https://fbref.com/en/matches/96f5ee84/Newcas…
#> $ Team <chr> "Newcastle United", "Newcastle United", "Newc…
#> $ Home_Away <chr> "Home", "Home", "Home", "Home", "Home", "Home…
#> $ Player <chr> "Callum Wilson", "Chris Wood", "Joelinton", "…
#> $ Player_Num <dbl> 9, 20, 7, 24, 10, 28, 23, 39, 8, 36, 33, 4, 1…
#> $ Nation <chr> "ENG", "NZL", "BRA", "PAR", "FRA", "ENG", "EN…
#> $ Pos <chr> "FW", "FW", "LW", "RW", "RW", "LM", "LM", "CM…
#> $ Age <chr> "30-244", "30-326", "26-076", "28-261", "25-2…
#> $ Min <dbl> 85, 5, 90, 85, 5, 70, 20, 82, 8, 90, 90, 70, …
#> $ CrdY <dbl> 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
#> $ CrdR <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
#> $ `2CrdY` <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
#> $ Fls <dbl> 2, 0, 1, 2, 0, 0, 1, 0, 0, 2, 1, 1, 0, 0, 1, …
#> $ Fld <dbl> 1, 0, 0, 1, 1, 0, 0, 4, 0, 0, 1, 0, 0, 0, 0, …
#> $ Off <dbl> 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
#> $ Crs <dbl> 0, 0, 2, 1, 0, 1, 1, 1, 0, 2, 1, 0, 0, 0, 0, …
#> $ Int <dbl> 0, 0, 0, 0, 0, 1, 0, 3, 1, 1, 0, 1, 0, 0, 0, …
#> $ TklW <dbl> 0, 0, 2, 1, 0, 2, 0, 1, 0, 2, 1, 1, 0, 0, 0, …
#> $ PKwon <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
#> $ PKcon <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
#> $ OG <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
#> $ Recov <dbl> 1, 0, 7, 3, 0, 6, 1, 11, 1, 5, 4, 4, 1, 7, 0,…
#> $ Won_Aerial_Duels <dbl> 1, 0, 3, 0, 0, 0, 0, 0, 0, 1, 4, 3, 0, 0, 0, …
#> $ Lost_Aerial_Duels <dbl> 2, 0, 1, 0, 0, 0, 0, 1, 0, 2, 1, 0, 0, 0, 0, …
#> $ Won_percent_Aerial_Duels <dbl> 33.3, NA, 75.0, NA, NA, NA, NA, 0.0, NA, 33.3…
Closing now, as we no longer support fotmob 😭
More of a question than issue. I couldn't find any information on yellow and red cards (I am using fotmob_get_match_players() function and was expecting to find it here). Any chance this can be added?