Unemployment of Europe in 2014 by NUTS 2 region

April 25, 2015

(This article was first published on Wiekvoet, and kindly contributed to R-bloggers)

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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


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)