Mapping the past and the future with Leaflet

[This article was first published on 56north | Skræddersyet dataanalyse » Renglish, 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.

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:

  1. FRDK115: Population projections 2015 for the country by ancestry, sex and age
  2. FOLK2: Population 1. January by sex, age, ancestry, country of origin and citizenship
  3. 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:

  1. Urban Denmark looks like Denmark in the past when it comes to age
  2. 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:

screenshot-www.56n.dk 2015-07-30 01-12-50

You can see the full interactive leaflet maps here:

The Past and Future of Age in Denmark

The Past and Future of Ancestry in Denmark

 

Now go make your very own cool maps! There is a guide on R-bloggers that gives a good introduction to the Leaflet package.

To leave a comment for the author, please follow the link and comment on their blog: 56north | Skræddersyet dataanalyse » Renglish.

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)