antagomir on master
Try fix XML GHA (compare)
antagomir on master
ok (compare)
github-actions[bot] on master
Re-build README.Rmd (compare)
antagomir on master
Revert "build ok" This reverts… quickdf removed (compare)
github-actions[bot] on master
Re-build README.Rmd (compare)
antagomir on master
ok build ok (compare)
antagomir on quickdf
ok (compare)
github-actions[bot] on gh-pages
Built site for eurostat: 3.7.10… (compare)
rgdal
/sf
) for reading.
just a quick look here:
http://ec.europa.eu/eurostat/cache/GISCO/distribution/v1/ref-nuts-2013.html makes it clear that we would need to rethink few things with the package.
The main thing being that the geofile we have used contains all the different NUTS-levels and with an inner_join
you have been able to subset the geodata to the same levels as your Eurostat attribute data is. Here each level is separated into its own file which will require user to spesify the NUTS level explicitly. Certainly is would be more clear to have them separate, but I kind of like the current behaviour when a single geodata always matches your primary Eurostat data.
get_eurostat
you dont need to specify the NUTS level, and the levels available varies between datasets. However, experienced user should be aware of this and able to download the right geodata, I think.
Right, we can do that by downloading all the levels, row_binding and merging I suppose.
So, this works fine at NUTS2-level:
library(eurostat)
# 1. Lataa data
sp_data <- get_eurostat("tgs00026", time_format = "raw", stringsAsFactors = FALSE) %>%
# filtteroi vuoteen 2014 ja tasolle NUTS-2 (merkkien määrä == 4) eli vaikka FI02
dplyr::filter(time == 2014, nchar(as.character(geo)) == 4)
# 2. Lataa geodata NUTS3-tasolla (RAAKAA KOODIA)
library(sf)
library(dplyr)
jsontemp <- tempfile()
download.file("http://ec.europa.eu/eurostat/cache/GISCO/distribution/v1/geojson/nuts-2013/NUTS_RG_60M_2013_4258_LEVL_2.geojson",
jsontemp)
nuts2 <- sf::st_read(jsontemp, stringsAsFactors = FALSE)
# 3. yhdistä
map <- left_join(nuts2,sp_data, by = c("NUTS_ID" = "geo"))
# 4. piirrä kartta
library(tmap)
tm_shape(map) +
tm_polygons("values",
title = "Disposable household\nincomes in 2010",
palette = "Oranges")
geojson
file, not the topojson
. File size in topojson
is marginally smaller, but it contains either epsg (SRID)
nor proj4string
field when read with st_read()
rbind
all the levels as in this examplelibrary(eurostat)
# 1. Lataa data
sp_data <- get_eurostat("ilc_li01", time_format = "raw", stringsAsFactors = FALSE) %>%
# filtteroi vuoteen 2014 ja tasolle NUTS-2 (merkkien määrä == 4) eli vaikka FI02
dplyr::filter(time == 2016, hhtyp == "A1", currency == "EUR", indic_il == "LI_C_M40")
# 2. Lataa geodata KAIKILLA NUTS-tasolla
library(sf)
library(dplyr)
# NUTS0
jsontemp <- tempfile()
download.file("http://ec.europa.eu/eurostat/cache/GISCO/distribution/v1/geojson/nuts-2013/NUTS_RG_60M_2013_4258_LEVL_0.geojson",
jsontemp)
nuts0 <- sf::st_read(jsontemp, stringsAsFactors = FALSE)
# NUTS1
jsontemp <- tempfile()
download.file("http://ec.europa.eu/eurostat/cache/GISCO/distribution/v1/geojson/nuts-2013/NUTS_RG_60M_2013_4258_LEVL_1.geojson",
jsontemp)
nuts1 <- sf::st_read(jsontemp, stringsAsFactors = FALSE)
# NUTS2
jsontemp <- tempfile()
download.file("http://ec.europa.eu/eurostat/cache/GISCO/distribution/v1/geojson/nuts-2013/NUTS_RG_60M_2013_4258_LEVL_2.geojson",
jsontemp)
nuts2 <- sf::st_read(jsontemp, stringsAsFactors = FALSE)
# NUTS0
jsontemp <- tempfile()
download.file("http://ec.europa.eu/eurostat/cache/GISCO/distribution/v1/geojson/nuts-2013/NUTS_RG_60M_2013_4258_LEVL_3.geojson",
jsontemp)
nuts3 <- sf::st_read(jsontemp, stringsAsFactors = FALSE)
nuts <- rbind(nuts0,nuts1,nuts2,nuts3)
# 3. yhdistä
map <- inner_join(nuts,sp_data, by = c("NUTS_ID" = "geo"))
# 4. piirrä kartta
library(tmap)
tm_shape(map) +
tm_polygons("values",
title = "Poverty thresholds",
palette = "Oranges")
http://ec.europa.eu
as with Eurostat-package and requires no new domain to be whitelisted by IT..