From 5c7e20590ef3cb0fd4116804e7d49931c6df871a Mon Sep 17 00:00:00 2001 From: dieghernan Date: Mon, 21 Sep 2020 07:40:37 +0000 Subject: [PATCH 1/4] Fix typo --- R/get_eurostat_geospatial.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/get_eurostat_geospatial.R b/R/get_eurostat_geospatial.R index 37a2a0db..a9146bcc 100755 --- a/R/get_eurostat_geospatial.R +++ b/R/get_eurostat_geospatial.R @@ -17,7 +17,7 @@ #' "2003", "2006", "2010", "2013", "2016" or "2021" #' @param cache a logical whether to do caching. Default is \code{TRUE}. Affects #' only queries from the bulk download facility. -#' @param update_cache a locigal whether to update cache. Can be set also with +#' @param update_cache a logical whether to update cache. Can be set also with #' options(eurostat_update = TRUE) #' @param cache_dir a path to a cache directory. The directory have to exist. #' The \code{NULL} (default) uses and creates From f93714b18277b4bebcb1905302ced73c414f5302 Mon Sep 17 00:00:00 2001 From: dieghernan Date: Mon, 21 Sep 2020 07:42:00 +0000 Subject: [PATCH 2/4] Check equality on chars and no numbers --- R/get_eurostat_geospatial.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/get_eurostat_geospatial.R b/R/get_eurostat_geospatial.R index a9146bcc..950b996d 100755 --- a/R/get_eurostat_geospatial.R +++ b/R/get_eurostat_geospatial.R @@ -113,7 +113,7 @@ Please check your connection and/or review your proxy settings") # information regarding their licence agreements. # ") - if (resolution == "60" && year == 2016 && crs == "4326"){ + if (resolution == "60" && year == "2016" && crs == "4326"){ if (nuts_level %in% c("all")){ shp <- eurostat_geodata_60_2016 @@ -229,7 +229,7 @@ Please check your connection and/or review your proxy settings") } } - if (resolution != "60" & year != 2016){ + if (resolution != "60" & year != "2016"){ if (cache & file.exists(cache_file)) { cf <- path.expand(cache_file) message(paste("Reading cache file", cf)) From 1807cc9c02f1b23318228cdb448e783e49e3abf4 Mon Sep 17 00:00:00 2001 From: dieghernan Date: Mon, 21 Sep 2020 07:46:41 +0000 Subject: [PATCH 3/4] Improve caching on different crs --- R/get_eurostat_geospatial.R | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/R/get_eurostat_geospatial.R b/R/get_eurostat_geospatial.R index 950b996d..39d66244 100755 --- a/R/get_eurostat_geospatial.R +++ b/R/get_eurostat_geospatial.R @@ -161,7 +161,7 @@ Please check your connection and/or review your proxy settings") cache_file <- file.path(cache_dir, paste0( output_class, resolution, - nuts_level, year, ".RData") + nuts_level, year, crs, ".RData") ) } @@ -229,20 +229,20 @@ Please check your connection and/or review your proxy settings") } } - if (resolution != "60" & year != "2016"){ - if (cache & file.exists(cache_file)) { - cf <- path.expand(cache_file) - message(paste("Reading cache file", cf)) - load(file = cache_file) - if (output_class == "sf") message(paste("sf at resolution 1:", + if (!(resolution == "60" & year == "2016" & crs == "4326")){ + if (cache & file.exists(cache_file)) { + cf <- path.expand(cache_file) + message(paste("Reading cache file", cf)) + load(file = cache_file) + if (output_class == "sf") message(paste("sf at resolution 1:", resolution, " from year ", year," read from cache file: ", cf)) - if (output_class == "df") message(paste("data_frame at resolution 1:", + if (output_class == "df") message(paste("data_frame at resolution 1:", resolution, " from year ", year," read from cache file: ", cf)) - if (output_class == "spdf") message(paste("SpatialPolygonDataFrame at resolution 1:", + if (output_class == "spdf") message(paste("SpatialPolygonDataFrame at resolution 1:", resolution, " from year ", year," read from cache file: ", cf)) From f2d35b56313805308b5f224e9b0aac03ab9d45d4 Mon Sep 17 00:00:00 2001 From: dieghernan Date: Mon, 21 Sep 2020 08:30:03 +0000 Subject: [PATCH 4/4] Update man --- man/get_eurostat_geospatial.Rd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/get_eurostat_geospatial.Rd b/man/get_eurostat_geospatial.Rd index 8ea081e7..43ed9070 100755 --- a/man/get_eurostat_geospatial.Rd +++ b/man/get_eurostat_geospatial.Rd @@ -36,7 +36,7 @@ either \code{sf} \code{simple features}, \code{df} (\code{data_frame}) or \item{cache}{a logical whether to do caching. Default is \code{TRUE}. Affects only queries from the bulk download facility.} -\item{update_cache}{a locigal whether to update cache. Can be set also with +\item{update_cache}{a logical whether to update cache. Can be set also with options(eurostat_update = TRUE)} \item{cache_dir}{a path to a cache directory. The directory have to exist.