Unemployment of Europe in 2014 by NUTS 2 region

[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.

During the Christmas break I worked on some code to show unemployment by NUTS 2 region. At that point no 2014 data was available. When I noticed the 214 was available I dug up the code and plotted again.

Data and Code

As written, the code was made beginning this year. At that point it seemed Eurostat’s directories had all moved and hence SmarterPoland was not used. Consequently, it is not used here either. However it seems to be much more easily than doing the data extraction work myself.
The mapping is created based on code found at rpubs.com: Mapping Data from Eurostat using R. The main change I made was using as continuous a scale as possible. I wanted to see details in southern Germany, but also let the scale show details in the worst regions. It appears not Greece but southern Spain has the worst unemployment. But since Spain has some better regions overall as country it seems a bit better off than Greece. The color then, are a trade off between red is bad, green is good and an ordering where colors are unique. Hence orange sits between yellow and blue to avoid yellow and blue mixing to deliver green again. I have the nagging feeling that it will be horrific for colorblind people.
In addition, I removed France’s overseas parts and added a legend.

# create a new empty object called ‘temp’ in which to store a zip file
# containing boundary data
# temp <- tempfile(fileext = ".zip")
# now download the zip file from its location on the Eurostat website and
# put it into the temp object
# new Eurostat website
# old: http://epp.eurostat.ec.europa.eu
# new: http://ec.europa.eu/eurostat

# download.file(
# “http://ec.europa.eu/eurostat/cache/GISCO/geodatafiles/NUTS_2010_60M_SH.zip”,temp)
# now unzip the boundary data
# unzip(temp)

EU_NUTS <- readOGR(dsn = "./NUTS_2010_60M_SH/data", layer = "NUTS_RG_60M_2010")
ToRemove <- [email protected]$STAT_LEVL!=2 | grepl('FR9',[email protected]$NUTS_ID)
EUN <- EU_NUTS[!ToRemove,]

## OGR data source with driver: ESRI Shapefile 
## Source: “./NUTS_2010_60M_SH/data”, layer: “NUTS_RG_60M_2010”
## with 1920 features and 4 fields
## Feature type: wkbPolygon with 2 dimensions

myunempl <- read.csv('lfst_r_lfu3rt.csv',na=':',skip=10)

#EU_NUTS <- spTransform(EU_NUTS, CRS("+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m [email protected] +no_defs"))

[email protected] = data.frame([email protected][,1:4], myunempl[
        match([email protected][, “NUTS_ID”],myunempl[, “GEO.TIME”]),   ])

EUN <- EUN[!is.na([email protected]$X2014),]

plot <- plot(EUN, col = rgb(colorRamp(
                ‘Dark Blue’,’Light Blue’,’Purple’,’Red’))
 (([email protected]$X2014-min([email protected]$X2014))/
     (max([email protected]$X2014)-min([email protected]$X2014)))/255), 
 axes = FALSE, border = NA)    

    zlim=c(min([email protected]$X2014),max([email protected]$X2014)),
            ‘Dark Blue’,’Light Blue’,’Purple’,’Red’))(seq(0,1,length.out=50))/255),

To leave a comment for the author, please follow the link and comment on their blog: Wiekvoet.

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)