Skip to content

Commit

Permalink
Update healthcare and education
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Aug 1, 2024
1 parent d65f7af commit dfb1285
Show file tree
Hide file tree
Showing 21 changed files with 85 additions and 27 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 }}

23 changes: 20 additions & 3 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 @@ -112,6 +117,7 @@ references:
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 +133,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 +147,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 All @@ -151,6 +159,7 @@ references:
name: R Foundation for Statistical Computing
address: Vienna, Austria
year: '2024'
doi: 10.32614/CRAN.package.utils
- type: software
title: dplyr
abstract: 'dplyr: A Grammar of Data Manipulation'
Expand All @@ -175,6 +184,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 +203,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 +243,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 +254,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 +269,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 +282,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 +327,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 +339,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
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 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.

# 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_entry))


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
9 changes: 6 additions & 3 deletions 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 @@ -183,6 +186,7 @@ We now download the data from Eurostat:
library(eurostat)
popdens <- get_eurostat("demo_r_d3dens") %>%
filter(TIME_PERIOD == "2021-01-01")
#> indexed 0B in 0s, 0B/sindexed 1.00TB in 0s, 395.58TB/s
```

By last, we merge and manipulate the data for creating the final plot:
Expand Down Expand Up @@ -326,7 +330,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 Expand Up @@ -360,8 +364,7 @@ This package is in no way officially related to or endorsed by Eurostat.

## References

<div id="refs" class="references csl-bib-body hanging-indent"
entry-spacing="0">
<div id="refs" class="references csl-bib-body hanging-indent">

<div id="ref-RJ-2017-019" class="csl-entry">

Expand Down
6 changes: 3 additions & 3 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"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",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.4.1 (2024-06-14 ucrt)",
"runtimePlatform": "R version 4.4.1 (2024-06-14)",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
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": "1250.359KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down
Binary file modified data/gisco_countrycode.rda
Binary file not shown.
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.
4 changes: 2 additions & 2 deletions inst/schemaorg.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"runtimePlatform": "R version 4.4.1 (2024-06-14 ucrt)",
"version": "0.5.1"
"runtimePlatform": "R version 4.4.1 (2024-06-14)",
"version": "0.5.1.9000"
},
{
"id": "https://doi.org/10.32614/CRAN.package.giscoR",
Expand Down
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.

Binary file modified vignettes/africa-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 vignettes/country-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 vignettes/giscoR-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 6 additions & 5 deletions vignettes/giscoR.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,18 @@ nuts2_sf <- nuts2 %>%
values_th = values / 1000,
categ = cut(values_th, c(0, 15, 30, 60, 90, 120, Inf))
)
#> Error in UseMethod("left_join"): no applicable method for 'left_join' applied to an object of class "NULL"


# Adjust the labels
labs <- levels(nuts2_sf$categ)
#> Error in eval(expr, envir, enclos): object 'nuts2_sf' not found
labs[1] <- "< 15"
#> Error in labs[1] <- "< 15": object of type 'closure' is not subsettable
labs[6] <- "> 120"
#> Error in labs[6] <- "> 120": object of type 'closure' is not subsettable
levels(nuts2_sf$categ) <- labs
#> Error: object 'nuts2_sf' not found


# Finally the plot
Expand Down Expand Up @@ -249,9 +254,5 @@ ggplot(nuts2_sf) +
"Source: Eurostat\n ", gisco_attributions()
)
)
#> Error in eval(expr, envir, enclos): object 'nuts2_sf' not found
```

<div class="figure">
<img src="./giscoR-1.png" alt="Disposable income of private households by NUTS 2 regions (2021)" width="100%" />
<p class="caption">Disposable income of private households by NUTS 2 regions (2021)</p>
</div>

0 comments on commit dfb1285

Please sign in to comment.