From 4abc95df6a4f5bc3f548d333e3e000a92e6bed9e Mon Sep 17 00:00:00 2001 From: antagomir Date: Sun, 20 May 2018 13:24:38 +0200 Subject: [PATCH] Ready for CRAN --- R/get_eurostat_json.R | 7 +++-- R/get_eurostat_raw.R | 7 +++-- docs/articles/blogposts.html | 2 +- docs/articles/cheatsheet.html | 2 +- docs/articles/eurostat_tutorial.html | 45 +++++++++++++++------------ docs/articles/publications.html | 2 +- vignettes/eurostat_tutorial.Rmd | 22 +++++++------ vignettes/eurostat_tutorial.md | 40 ++++++++++++++---------- vignettes/fig/maps2-1.pdf | Bin 10799 -> 10799 bytes vignettes/fig/plotGallery-1.pdf | Bin 8168 -> 8168 bytes vignettes/fig/trains_plot-1.pdf | Bin 5783 -> 5783 bytes 11 files changed, 73 insertions(+), 54 deletions(-) diff --git a/R/get_eurostat_json.R b/R/get_eurostat_json.R index 893627f9..eb76ca34 100755 --- a/R/get_eurostat_json.R +++ b/R/get_eurostat_json.R @@ -60,16 +60,17 @@ get_eurostat_json <- function(id, filters = NULL, status <- httr::status_code(resp) # check status and get json + msg <- ". Some datasets are not accessible via the eurostat interface. You can try to search the data manually from the comext database at http://epp.eurostat.ec.europa.eu/newxtweb/ or bulk download facility at http://ec.europa.eu/eurostat/estat-navtree-portlet-prod/BulkDownloadListing or annual Excel files http://ec.europa.eu/eurostat/web/prodcom/data/excel-files-nace-rev.2" if (status == 200){ jdat <- jsonlite::fromJSON(url) } else if (status == 400){ stop("Failure to get data. Probably invalid dataset id. Status code: ", - status) + status, msg) } else if (status == 500){ stop("Failure to get data. Probably filters did not return any data - or data exceeded query size limitation. Status code: ", status) + or data exceeded query size limitation. Status code: ", status, msg) } else { - stop("Failure to get data. Status code: ", status) + stop("Failure to get data. Status code: ", status, msg) } # get json data diff --git a/R/get_eurostat_raw.R b/R/get_eurostat_raw.R index 620ecc35..fa30ce64 100755 --- a/R/get_eurostat_raw.R +++ b/R/get_eurostat_raw.R @@ -35,11 +35,14 @@ get_eurostat_raw <- function(id) { col_types = readr::cols(.default = readr::col_character())) # check validity + if (ncol(dat) < 2 | nrow(dat) < 1) { + msg <- ". Some datasets are not accessible via the eurostat interface. You can try to search the data manually from the comext database at http://epp.eurostat.ec.europa.eu/newxtweb/ or bulk download facility at http://ec.europa.eu/eurostat/estat-navtree-portlet-prod/BulkDownloadListing or annual Excel files http://ec.europa.eu/eurostat/web/prodcom/data/excel-files-nace-rev.2" if (grepl("does not exist or is not readable", dat[1])) { - stop(id, " does not exist or is not readable") + + stop(id, " does not exist or is not readable", msg) } else { - stop(paste("Could not download ", id)) + stop(paste("Could not download ", id, msg)) } } diff --git a/docs/articles/blogposts.html b/docs/articles/blogposts.html index 765e1d5f..c42155e3 100755 --- a/docs/articles/blogposts.html +++ b/docs/articles/blogposts.html @@ -83,7 +83,7 @@