Posted on January 13, 2013 by Wingfeet in Uncategorized | 0 Comments
[This article was first published on Wiekvoet, 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.
Last week on the radio I heard a story of southern Europeans and Irish looking for better times in northern Europe. I heard the tale of an Italian academic who left Italy to end up waiting tables in an Italian restaurant in the Netherlands. Obviously this is not good, not good for Italy which loses its academics, not good for somebody who actually desires to wait tables. I cannot blame the Italian academic though. I also heard the tale of an Irish guy who ended up working for ASML, which is much better (except for Ireland obviously). Based on this tale I wondered if this migration is big enough to be visible in population statistics and would make for nice plots. Eurostat, the European Statistical Agency, is the place to get such data. Since I tend to want to look at data then decide, I took all years and countries. My chosen format was year and country in columns, with adjacent the population, migration, natural change, births and deaths.
First thing to do, was have a go at the labels, which were extremely long.
As can be seen, the list of countries is fairly long. After checking I found that “France (metropolitan)” is the part of France within Europe, while France in addition contains parts outside Europe.
Next step was to make relative changes and a plot.
r1$RelMig <- 100*r1$MigrationA/r1$Population
r1$RelNC <- 100*r1$NatChange/r1$Population
r1$RelCh <- 100*r1$TotChange/r1$Population
r1$RelB <- 100*r1$LiveBirths/r1$Population
r1$RelD <- 100*r1$Deaths/r1$Population
xyplot(RelMig+RelNC+RelCh+RelB+RelD ~ Year | Region,data=r1,type=’l’,
Most obvious ‘features’ of this plot are too many countries, still too long country names. Data shows big migration in FYROM (Macedonia), Albania, and Bosnia Herzegovina, which swamps all other information. Clearly war has big effect on migration, more than the economy. There are also a number of countries with only limited years.
In the plot the vertical blue line represents start of the Euro zone, while the red line represents start of the crisis. The data had quite some surprises for me. Large crisis effects in Iceland and Ireland, much larger than in southern Europe. Big immigration in in Luxembourg. Big immigration in Italy, Spain, Iceland and Ireland before the crisis. And yes, the crisis did cause emigration in Spain and Greece. Not big, but 2012 data is not yet available. Finally, regarding all those Polish working in western Europe, I don’t see an effect in Poland.
Finally, I wanted to do the same in ggplot2. It took me ages to learn lattice, now it starts again with ggplot2. Unfortunately I did not manage to make the countries to cover both rows and columns, so the number of countries is more reduced. I was not able to place the legend title above the legend either.