The Growth of Soccer (1872 – Present)

[This article was first published on World Soccer Analytics, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Soccer (football) is one of the world’s most popular sports, played and watched by millions of people all around the world. But while today it is played in virtually every country, it hasn’t always been that way.

As you can see in the animated map below, soccer started off as a small sport, segregated to the United Kingdom, but has since become a world phenomenon.

world_cup_matches_wordpress1.gif

A few interesting stats to note:

  • Kuala Lumpur has hosted 572 international matches (as of July 2018), more than any other city
  • Doha (Qatar) has hosted the highest number of international matches in one single year (38 matches, in 2011)
  • Bodø, Norway hosted the northernmost international match (67.28036, 14.404916), while Dunedin, New Zealand was host to the southernmost international match (at -45.87876, 170.50280)
  • Four cities have hosted international matches under three different country names:
    • Belgrade under Yugoslavia, Serbia & Montenegro, and Serbia
    • Dublin under Ireland, Irish Free State, and Éire
    • Prague under Bohemia, Czechoslovakia, and Czech Republic
    • Salisbury under Southern Rhodesia, Rhodesia, and Zimbabwe

 

Code Snippets:

df <- read_csv("results.csv")
df$year % year()
df_by_year % count(city,country,year)

df_by_year$city_country <- paste(df_by_year$city,", ", 
df_by_year$country, sep="")


for(i in 1:nrow(df_by_year)){
 result <- geocode(df_by_year$city_country[i], 
 output = "latlona", 
 source = "google",
 override_limit = TRUE)
 df_by_year$lon[i] <- as.numeric(result[1])
 df_by_year$lat[i] <- as.numeric(result[2])
}

df_by_year_all <- df_by_year %>% 
tidyr::complete(nesting(city, 
lon, 
lat), 
year,
fill = list(n = 0))

df_by_year_all <- df_by_year_all %>% group_by(city,lat,lon) %>%
mutate(cs=cumsum(n))


saveGIF({
for (i in 1872:2018) {

year_games <- as.character(i)

year_data <- df_by_year_all %>% filter(year == i,
cs>0)
gg <- ggplot() +
borders("world", colour="gray40", fill="beige") +
theme_map()

final_map <- gg + geom_point(data=
year_data,
aes(x = lon, 
y = lat) ,
alpha = 0.5, 
colour = "darkred") + 
ggtitle(paste0('International Soccer Matches, 1872 - ', year_games)) + 
theme(legend.position="none")+theme(plot.title = element_text(size = 25, face= "bold",
hjust = 0.5))

print(final_map)

}
}, movie.name = 'world_cup_matches_wordpress1.gif', 
interval = 0.2, ani.width = 1000, ani.height = 700)

 

For the full code, please refer to: https://github.com/stefangouyet/How-Soccer-Grew

 

To leave a comment for the author, please follow the link and comment on their blog: World Soccer Analytics.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)