library(worldcup)
Whether you're a soccer fan or a data scientist, the worldcup package is definitely worth checking out. So, go ahead and get ready to dive into the world of World Cup data! worldcup r package jfjelstul
goals %>% group_by(match_id) %>% summarise(total_goals = n(), .groups = "drop") %>% arrange(desc(total_goals)) %>% left_join(matches, by = "match_id") %>% select(year, home_team, away_team, total_goals) %>% slice(1:3) library(worldcup) Whether you're a soccer fan or a
The package includes several key tables that can be joined to create complex analyses: tournaments : General info on each World Cup year. matches : Results, venues, and attendance for every game. goals : Minute-by-minute data on who scored and how. matches : Results, venues, and attendance for every game
| Year | Home Team | Away Team | Total Goals | |------|-----------|-----------|-------------| | 1954 | Austria | Switzerland | 12 | | 1938 | Sweden | Cuba | 8 | | 1954 | Hungary | South Korea | 9 |
The package relies on ID columns (e.g., match_id , team_id , player_id ). Don't try to join on names (e.g., "USA" vs "United States"). Always use the provided ID columns to avoid mismatches.