This gist shows how to create an animated world map of life expectancy using R. The data comes the UN World Population Prospects, 2015 Revision, and it brings life expectancy data from 1950 untill 2015 and projeceted data up to 2100. Thanks Topi Tjukanov, who reminded me of the UN DESA data portal, where you can find this dataset and many others
The idea is to use open data to create a GIF, much like the ones created by Aron Strandberg but his maps look much nicer. The output of this script is a map like this one:
[![enter image description here][1]][1]
Now diving into the code. First, let's load the necessary libraries and get the data. As of this writing, the current version of gganimate
has a bug that messes the aesthetics of the .gif
file. As a temporary solution, I've intalled an older version of the package, [as recommended by the author of the gganimate
, David Ro