Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NUTS 2 Version 2006 and 2013 incompatible? #33

Closed
kklamsi opened this issue Sep 4, 2017 · 1 comment
Closed

NUTS 2 Version 2006 and 2013 incompatible? #33

kklamsi opened this issue Sep 4, 2017 · 1 comment

Comments

@kklamsi
Copy link

kklamsi commented Sep 4, 2017

Hi,
we are using the cartography package to look at different variables of interest across Europe. We take the data for our variables from EUROSTAT via the eurostat package where they use the latest NUTS2 version which is from 2013. As the NUTS 2 data in your package is from 2006 we face the following problem: some NUTS2 regions in Italy, Finland and Germany cannot be displayed because they got renamed (Map): emprt_16_map.pdf

Our script to plot the map looks like this:

BIP <- get_eurostat("nama_10r_2gdp", time_format = "raw")
data(nuts2006)
opar <- par(mar = c(0,0,0,0))

nuts_2 <- nuts2.df$id
mapdata <- filter(BIP, unit == "PPS_HAB", time == max(time), geo %in% c(nuts_2))
mapdata <- select(mapdata, geo, values)
names(mapdata)[1] <- "id"

Merge nuts and bip

nuts2.df <- merge(nuts2.df, mapdata, by="id")

cols <- c("#d7191c","#fdae61","#ededad","#a6d96a","#1a9641")

Plot a layer with the extent of the EU28 countries with only a background color

plot(nuts0.spdf, border = NA, col = NA, bg = "#A6CAE0")

Plot non european space

plot(world.spdf, col = "#F9F9F7", border=NA, add=TRUE)

Plot the bip

choroLayer(spdf = nuts2.spdf, # SpatialPolygonsDataFrame of the regions
df = nuts2.df, # data frame with bip
var = "values", # bip field in df
nclass = 5,
method = "quantile",
col = cols, # colors
border = "grey40", # color of the polygons borders
lwd = 0.5, # width of the borders
legend.pos = "topright", # position of the legend
legend.title.txt = "BIP je\nEinwohner", # title of the legend
legend.values.rnd = 0, # number of decimal in the legend values
add = TRUE) # add the layer to the current plot

Plot a layer of countries borders

plot(nuts0.spdf,border = "grey20", lwd=0.75, add=TRUE)
plot(nuts2.spdf,border= "grey20", lwd=0.2, add=TRUE)

par(opar)

Do you have any suggestions how we could solve this problem? Did we miss an important setting?
We can solve the problem by renaming the "geo" variable but if there is a better way we would be glad.

Thanks for your help!

@kklamsi kklamsi changed the title NUTS 2 Version 2006 and 2013 incompatible NUTS 2 Version 2006 and 2013 incompatible? Sep 4, 2017
@rCarto
Copy link
Member

rCarto commented Sep 5, 2017

Hello,
Changes between 2006 and 2013 NUTS versions implies a bit more than just a change in names (some borders have been modified), so renaming the geo variable won't fix the problem. You have to use a NUTS 2 2013 version basemap. We made this version available here: https://github.com/riatelab/nuts

In this gist (https://gist.github.com/rCarto/70e766cae618d50f14200044460b063b) you will find how to produce the following map.

image

@rCarto rCarto closed this as completed Sep 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants