R bloggers

Animating Changes in Football Kits using R

FavoriteLoadingAdd to favorites

Background I am enjoying the magick package at the moment. Reading through the vignette I spotted the image_morph() function. In this post I experiment with the function to build the GIF below that shows the changes in the England football first kit over time, using images from the excellent Historical Football Kits website. Scraping The Historical Football Kits website has a detailed section on England kits spread over six pages, starting from the first outfits used in 1872. Each pages includes some interesting discussion – and importantly for this post – images of the kits. We can use the read_html() from the xml2 package and map() from purrr to read and save the source code of each page. library(rvest) library(tidyverse) htmls <- c( “http://www.historicalkits.co.uk/international/england/england-1872-1939.html”, “http://www.historicalkits.co.uk/international/england/england-1946-1960.html”, “http://www.historicalkits.co.uk/international/england/england-1960-1983.html”, “http://www.historicalkits.co.uk/international/england/england-1984-1997.html”, “http://www.historicalkits.co.uk/international/england/england-1997-2010.html”, “http://www.historicalkits.co.uk/international/england/england-2010-2019.html” ) %>% map(read_html) From the source code we can then find…
Original Post: Animating Changes in Football Kits using R