devtools::install_github("jfjelstul/worldcup")

The graph that rendered told a stark, quiet story. The columns for the early years—1930, 1950, 1966—were short. The game was physical, but it wasn't cynical. But as the years ticked by, the red bars climbed. By the time he reached the 1990s and 2000s, the "Cards" variable had exploded.

matches %>% filter(tournament_id == "women") %>% mutate(winner = case_when( home_goals > away_goals ~ home_team, away_goals > home_goals ~ away_team, TRUE ~ "Draw" )) %>% left_join(teams, by = c("winner" = "team")) %>% filter(winner != "Draw") %>% count(confederation, sort = TRUE) %>% mutate(win_pct = n / sum(n))

matches %>% filter(tournament_id != "women") %>% group_by(year) %>% summarise(avg_goals = mean(home_goals + away_goals)) %>% ggplot(aes(x = year, y = avg_goals)) + geom_line() + labs(title = "Average goals per match at men's World Cups")

Whether you are looking to settle a pub debate about the greatest World Cup team or you are writing a peer-reviewed paper on sports economics, the worldcup package provides the robust foundation you need.