Eurostat has information on death rates by cause and NUTS 2 region. I am trying to get this visually displayed on the map. To get there I map all causes to three dimensions via a principal components analysis. These three dimensions are subsequently translated in RGB colors and placed in the map of Europe.
Death rates are from Eurostat table causes of death. I took crude death rate. On that website, from default setup I removed gender and added causes. Then I transposed causes to rows and regions to columns so I would not be bothered by translation of invalid column names. I exported those as .xls, but got only part of the regions. My second attempt was export as .csv. In general I prefer to take .xls from Eurostat as they separate thousands via a ‘,’, however, incomplete was not acceptable, so the .csv is used.
For the mapping the scipt used is based on rpubs: Mapping Data from Eurostat using R. However, some changes were needed as Eurostat reorganized there website. Another adaptation is that I removed all Frances’ overseas parts. These parts gave too much whitespace for my taste.
To explain the colors I did something similar as for the map itself. In order to avoid crowding the figure, only forty of the causes are displayed.
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
# now unzip the boundary data
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,]
r1 <- read.csv('hlth_cd_acdr2_1_Data.csv')
r1$Value <- as.character(r1$Value) %>%
r2 <- reshape(r1,direction='wide',
names(r2) <- gsub('Value.','',names(r2),fixed=TRUE)
r2 <- r2[!(r2$ICD10 %in%
row.names(r2) <- r2$ICD10_LABEL
m1 <- as.matrix(r2[,-(1:2)]) %>% t(.)
m2 <- m1[rownames(m1) %in% [email protected]$NUTS_ID,]
pr1 <- princomp(m2,cor=TRUE)
tom <- data.frame(
tom$rgb <- with(tom,rgb(rgbr,rgbg,rgbb))
[email protected] = data.frame([email protected][,1:4], tom[
match([email protected][, “NUTS_ID”],tom[, “loc”]), ])
plot <- plot(EUN, col = [email protected]$rgb,
axes = FALSE, border = NA)
load <- as.data.frame(as.matrix(pr1$loadings[,1:3]))
load$name <- rownames(pr1$loadings)
load <- mutate(load,