I have been working on mapping things for a while and I must say that I really like the Leaflet package from Rstudio. It makes it very easy and straight forward to make leaflet maps.
A while back I stumbled upon an interactive graphic from The Times, that used census data to compare each US state with the country as a whole to then show if this state was comparable to the US in the past, present or future (go to the link if this sounds confusing).
So I decided I wanted to do the same with danish data. Statistics Denmark has three relevant data sets for creating such a map:
- FRDK115: Population projections 2015 for the country by ancestry, sex and age
- FOLK2: Population 1. January by sex, age, ancestry, country of origin and citizenship
- FOLK1: Population at the first day of the quarter by municipality, sex, age, marital status, ancestry, country of origin and citizenship
FRDK115 show us the future of Denmark, FOLK2 shows us the past and FOLK1 show us the present.
In this data I can see age and ancestry, so I am able to make two kinds of maps: one that shows the present mean age of each danish municipality and comparing them with the country as a whole from 1980 – 2050, and one map that shows the present ancestry distribution in each danish municipality and comparing them with the country as a whole as well.
I colored the map to show what year each municipality was indicative of where yellow indicates the past and red the future. Each municipality got a little pop-up box that when you click it explains why its colored the way it is.
So two patterns emerge:
- Urban Denmark looks like Denmark in the past when it comes to age
- Urban Denmark looks like Denmark in the future when it comes to ancestry
If we want to see what kind of challenges Denmark will see in the future regarding an aging population we can look to some of the deep red municipalities in the outskits of Denmark on the age-map, whereas if we want to see what kind of challenges Denmark will see in the future regarding a more diverse ancestry we can look to some of the deep red municipalities in and around the capital area on the ancestry-map.
Here is an example:
You can see the full interactive leaflet maps here:
Now go make your very own cool maps! There is a guide on R-bloggers that gives a good introduction to the Leaflet package.