Skip to content

Commit

Permalink
Merge pull request #92 from rOpenGov/update24
Browse files Browse the repository at this point in the history
Update internal database to get new versions of the dataset (2024)
  • Loading branch information
dieghernan authored Aug 25, 2024
2 parents d65f7af + 51c4b12 commit cd78768
Show file tree
Hide file tree
Showing 22 changed files with 117 additions and 28 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/recheck.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Workflow derived from https://github.com/r-devel/recheck
on:
workflow_dispatch:
inputs:
which:
type: choice
description: Which dependents to check
options:
- strong
- most

name: r-devel reverse dependency check

jobs:
revdep_check:
name: Reverse check ${{ inputs.which }} dependents
uses: r-devel/recheck/.github/workflows/recheck.yml@v1
with:
which: ${{ inputs.which }}

25 changes: 19 additions & 6 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ message: 'To cite package "giscoR" in publications use:'
type: software
license: GPL-3.0-only
title: 'giscoR: Download Map Data from GISCO API - Eurostat'
version: 0.5.1
version: 0.5.1.9000
doi: 10.32614/CRAN.package.giscoR
identifiers:
- type: doi
value: 10.32614/CRAN.package.giscoR
abstract: Tools to download data from the GISCO (Geographic Information System of
the Commission) Eurostat database <https://ec.europa.eu/eurostat/web/gisco>. Global
and European map data available. This package is in no way officially related to
Expand All @@ -31,7 +34,7 @@ preferred-citation:
affiliation: rOpenGov
doi: 10.32614/CRAN.package.giscoR
year: '2024'
version: 0.5.1
version: 0.5.1.9000
url: https://ropengov.github.io/giscoR/
abstract: Tools to download data from the GISCO (Geographic Information System of
the Commission) Eurostat database <https://ec.europa.eu/eurostat/web/gisco>. Global
Expand Down Expand Up @@ -84,6 +87,7 @@ references:
email: vincent.arel-bundock@umontreal.ca
orcid: https://orcid.org/0000-0003-2042-7063
year: '2024'
doi: 10.32614/CRAN.package.countrycode
version: '>= 1.2.0'
- type: software
title: geojsonsf
Expand All @@ -96,6 +100,7 @@ references:
given-names: David
email: dcooley@symbolix.com.au
year: '2024'
doi: 10.32614/CRAN.package.geojsonsf
version: '>= 2.0.0'
- type: software
title: jsonlite
Expand All @@ -109,9 +114,7 @@ references:
email: jeroen@berkeley.edu
orcid: https://orcid.org/0000-0002-4035-0289
year: '2024'
identifiers:
- type: url
value: https://arxiv.org/abs/1403.2805
doi: 10.32614/CRAN.package.jsonlite
- type: software
title: rappdirs
abstract: 'rappdirs: Application Directories: Determine Where to Save Data, Caches,
Expand All @@ -127,6 +130,7 @@ references:
- family-names: Davis
given-names: Trevor
year: '2024'
doi: 10.32614/CRAN.package.rappdirs
version: '>= 0.3.0'
- type: software
title: sf
Expand All @@ -140,6 +144,7 @@ references:
email: edzer.pebesma@uni-muenster.de
orcid: https://orcid.org/0000-0001-8049-7069
year: '2024'
doi: 10.32614/CRAN.package.sf
version: '>= 0.9.0'
- type: software
title: utils
Expand Down Expand Up @@ -175,6 +180,7 @@ references:
email: davis@posit.co
orcid: https://orcid.org/0000-0003-4777-038X
year: '2024'
doi: 10.32614/CRAN.package.dplyr
- type: software
title: eurostat
abstract: 'eurostat: Tools for Eurostat Open Data'
Expand All @@ -193,6 +199,7 @@ references:
- family-names: Biecek
given-names: Przemyslaw
year: '2024'
doi: 10.32614/CRAN.package.eurostat
- type: software
title: ggplot2
abstract: 'ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics'
Expand Down Expand Up @@ -232,6 +239,7 @@ references:
name-particle: van den
orcid: https://orcid.org/0000-0002-9335-7468
year: '2024'
doi: 10.32614/CRAN.package.ggplot2
version: '>= 3.5.0'
- type: software
title: httr2
Expand All @@ -242,8 +250,9 @@ references:
authors:
- family-names: Wickham
given-names: Hadley
email: hadley@rstudio.com
email: hadley@posit.co
year: '2024'
doi: 10.32614/CRAN.package.httr2
- type: software
title: knitr
abstract: 'knitr: A General-Purpose Package for Dynamic Report Generation in R'
Expand All @@ -256,6 +265,7 @@ references:
email: xie@yihui.name
orcid: https://orcid.org/0000-0003-0645-5666
year: '2024'
doi: 10.32614/CRAN.package.knitr
- type: software
title: lwgeom
abstract: 'lwgeom: Bindings to Selected ''liblwgeom'' Functions for Simple Features'
Expand All @@ -268,6 +278,7 @@ references:
email: edzer.pebesma@uni-muenster.de
orcid: https://orcid.org/0000-0001-8049-7069
year: '2024'
doi: 10.32614/CRAN.package.lwgeom
version: '>= 0.2-2'
- type: software
title: rmarkdown
Expand Down Expand Up @@ -312,6 +323,7 @@ references:
email: rich@posit.co
orcid: https://orcid.org/0000-0003-3925-190X
year: '2024'
doi: 10.32614/CRAN.package.rmarkdown
- type: software
title: testthat
abstract: 'testthat: Unit Testing for R'
Expand All @@ -323,5 +335,6 @@ references:
given-names: Hadley
email: hadley@posit.co
year: '2024'
doi: 10.32614/CRAN.package.testthat
version: '>= 3.0.0'

2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: giscoR
Title: Download Map Data from GISCO API - Eurostat
Version: 0.5.1
Version: 0.5.1.9000
Authors@R: c(
person("Diego", "Hernangómez", , "diego.hernangomezherrero@gmail.com", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0001-8457-4658", affiliation = "rOpenGov")),
Expand Down
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# giscoR (development version)

## Update with latest data available

- `gisco_get_education()` and `gisco_get_healthcare()` gains a new `year`
argument: years available now are 2020 and 2023 versions of the dataset.
- `gisco_get_nuts()` and `gisco_get_countries()` now can download the 2024
version of the datasets.

# giscoR 0.5.1

- Use **CRAN** DOI: <https://doi.org/10.32614/CRAN.package.giscoR>.
Expand Down
12 changes: 7 additions & 5 deletions R/gisco_get_education.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @source
#' <https://ec.europa.eu/eurostat/web/gisco/geodata/basic-services>
#'
#' @inheritParams gisco_get_countries
#' @inheritParams gisco_get_healthcare
#'
#' @inheritSection gisco_get_countries About caching
#'
Expand All @@ -34,10 +34,12 @@
#' }
#' }
#' @export
gisco_get_education <- function(cache = TRUE, update_cache = FALSE,
gisco_get_education <- function(year = c("2023", "2020"),
cache = TRUE, update_cache = FALSE,
cache_dir = NULL, verbose = FALSE,
country = NULL) {
# Given vars
year <- match.arg(year)
epsg <- "4326"
ext <- "gpkg"

Expand All @@ -49,15 +51,15 @@ gisco_get_education <- function(cache = TRUE, update_cache = FALSE,


api_entry <- paste0(
"https://gisco-services.ec.europa.eu/pub/education/2020/",
"/gpkg/", country_get, ".gpkg"
"https://gisco-services.ec.europa.eu/pub/education/", year, "/gpkg/",
country_get, ".gpkg"
)

n_cnt <- seq_len(length(api_entry))

ress <- lapply(n_cnt, function(x) {
api <- api_entry[x]
filename <- basename(api)
filename <- paste0("edu_", year, "_", basename(api))


if (cache) {
Expand Down
12 changes: 7 additions & 5 deletions R/gisco_get_healthcare.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#' @source
#' <https://ec.europa.eu/eurostat/web/gisco/geodata/basic-services>
#'
#' @param year Release year of the file. One of `"2020"`, `"2023"` (default).
#' @inheritParams gisco_get_countries
#'
#' @inheritSection gisco_get_countries About caching
Expand All @@ -35,18 +36,19 @@
#' }
#' }
#' @export
gisco_get_healthcare <- function(cache = TRUE, update_cache = FALSE,
cache_dir = NULL, verbose = FALSE,
country = NULL) {
gisco_get_healthcare <- function(year = c("2023", "2020"), cache = TRUE,
update_cache = FALSE, cache_dir = NULL,
verbose = FALSE, country = NULL) {
# Given vars
year <- match.arg(year)
epsg <- "4326"
ext <- "gpkg"

api_entry <- paste0(
"https://gisco-services.ec.europa.eu/pub/healthcare/2020",
"https://gisco-services.ec.europa.eu/pub/healthcare/", year,
"/gpkg/EU.gpkg"
)
filename <- basename(api_entry)
filename <- paste0("health_", year, "_", basename(api_entry))


if (cache) {
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ install.packages("giscoR",

## Usage

You can have a look to the documentation of the dev version in
<https://ropengov.github.io/giscoR/dev/>

This script highlights some features of **giscoR** :

``` r
Expand Down Expand Up @@ -326,7 +329,7 @@ A BibTeX entry for LaTeX users is
doi = {10.32614/CRAN.package.giscoR},
author = {Diego Hernangómez},
year = {2024},
version = {0.5.1},
version = {0.5.1.9000},
url = {https://ropengov.github.io/giscoR/},
abstract = {Tools to download data from the GISCO (Geographic Information System of the Commission) Eurostat database <https://ec.europa.eu/eurostat/web/gisco>. Global and European map data available. This package is in no way officially related to or endorsed by Eurostat.},
}
Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"codeRepository": "https://github.com/rOpenGov/giscoR",
"issueTracker": "https://github.com/rOpenGov/giscoR/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.5.1",
"version": "0.5.1.9000",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down Expand Up @@ -240,7 +240,7 @@
"applicationCategory": "cartography",
"isPartOf": "http://ropengov.org/",
"keywords": ["ropengov", "r", "spatial", "api-wrapper", "rstats", "r-package", "eurostat", "gisco", "thematic-maps", "eurostat-data", "cran", "ggplot2", "gis"],
"fileSize": "1257.482KB",
"fileSize": "1258.247KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down
Binary file modified data/gisco_db.rda
Binary file not shown.
Binary file modified img/README-example-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/README-example-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/README-labels-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/README-thematic-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion inst/schemaorg.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"url": "https://cran.r-project.org"
},
"runtimePlatform": "R version 4.4.1 (2024-06-14 ucrt)",
"version": "0.5.1"
"version": "0.5.1.9000"
},
{
"id": "https://doi.org/10.32614/CRAN.package.giscoR",
Expand Down
2 changes: 1 addition & 1 deletion man/gisco_get.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/gisco_get_education.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/gisco_get_healthcare.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/gisco_get_nuts.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/gisco_get_units.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions tests/testthat/test-gisco_get_countries.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ test_that("Countries online", {
cache = FALSE
))

expect_silent(
gisco_get_countries(
year = 2024,
spatialtype = "BN",
resolution = 60,
cache = TRUE
)
)

expect_silent(gisco_get_countries(
spatialtype = "COASTL",
country = c("ESP", "ITA")
Expand Down
8 changes: 8 additions & 0 deletions tests/testthat/test-gisco_get_nuts.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ test_that("NUTS online", {
expect_equal(epsg3035, sf::st_crs(a))
expect_equal(epsg3857, sf::st_crs(b))
expect_equal(epsg4326, sf::st_crs(c))

expect_silent(aa <-
gisco_get_nuts(
year = 2024,
resolution = "60",
nuts_level = "0",
nuts_id = "ES5"
))
})


Expand Down
Loading

0 comments on commit cd78768

Please sign in to comment.