Type: Package
Title: Access Data from 'GISCO'
Version: 0.1.3
Description: Access data related to the European union from 'GISCO' https://ec.europa.eu/eurostat/web/gisco, the Geographic Information System of the European Commission, via its rest API at https://gisco-services.ec.europa.eu. This package tries to make it easier to get these data into R.
License: MIT + file LICENSE
Encoding: UTF-8
Depends: R (≥ 4.1.0)
Imports: dplyr, fs, httr2 (≥ 1.2.0), purrr, tibble, cli, rappdirs
Suggests: knitr, rmarkdown, ggplot2, sf, glue
RoxygenNote: 7.3.2
VignetteBuilder: knitr
URL: https://github.com/prokaj/eudata
BugReports: https://github.com/prokaj/eudata/issues
NeedsCompilation: no
Packaged: 2025-07-14 17:29:56 UTC; prokaj
Author: Vilmos Prokaj [aut, cre]
Maintainer: Vilmos Prokaj <prokaj.vilmos@gmail.com>
Repository: CRAN
Date/Publication: 2025-07-14 19:10:06 UTC

eudata: Access Data from 'GISCO'

Description

Access data related to the European union from 'GISCO' https://ec.europa.eu/eurostat/web/gisco, the Geographic Information System of the European Commission, via its rest API at https://gisco-services.ec.europa.eu. This package tries to make it easier to get these data into R.

Author(s)

Maintainer: Vilmos Prokaj prokaj.vilmos@gmail.com

See Also

Useful links:


Get content from the API

Description

This function retrieves the content from the API and saves it to a file if 'save_to_file' is TRUE.

Usage

get_content(
  api,
  end_point,
  save_to_file = FALSE,
  dest = if (save_to_file) fs::path_file(end_point) else NULL
)

Arguments

api

An endpoint to the dataset.

end_point

A character vector of the endpoint to retrieve content from.

save_to_file

A logical value indicating whether to save the content to a file

dest

A character vector specifying the destination file path. If 'save_to_file' is TRUE, this should be a valid file path.

Value

A 'httr2' response object. The content retrieved from the API is either the 'body' of response or the path to the file when 'save_to_file' is TRUE.

Examples

api <- get_topic("Postal")
files <- get_latest_files(api)$csv
file_to_download <- grep("_4326", files, value=TRUE)
response <- get_content(
  api,
  file_to_download,
  save_to_file = TRUE,
  dest = fs::file_temp(ext = "csv")
)
response$body

Get the content length of a file to download

Description

This function retrieves the content length of a file to be downloaded from the API.

Usage

get_content_length(api, file_to_download)

Arguments

api

An endpoint to the dataset variants.

file_to_download

A character vector of file names to download.

Value

An integer vector of content lengths, named by the file names.

Examples

api <- get_topic("Postal")
files <- get_latest_files(api)$csv
purrr::map(
  files,
  get_content_length,
  api = api) |>
  tibble::as_tibble()

Retrieve available datasets from an endpoint

Description

This function returns the list of available datasets as a tibble. The columns of the tibble provide information about each dataset.

Usage

get_datasets(api)

Arguments

api

An endpoint

Value

A tibble of available datasets.

Examples

get_topic("Coastal lines") |>
  get_datasets()


Retrieve the latest files from the API

Description

This function retrieves the files belonging to the latest version of the given dataset. When the dataset is not updated the cached version is returned.

Usage

get_latest_files(api)

Arguments

api

An endpoint to the dataset.

Value

A named list of files.

Examples

get_latest_files(get_topic("Postal"))$csv

Retrieve Topic Information

Description

This function fetches the details of a specific topic based on the provided topic name.

Usage

get_topic(topic)

Arguments

topic

A string representing the topic to retrieve.

Value

A request object to the specific endpoint.

Examples

get_topic("Coastal lines")
get_topic("Postal")

Retrieve Topics from API

Description

Retrieves a list of topics from the specified API endpoint 'https://gisco-services.ec.europa.eu/distribution/v2/'.

Usage

get_topics()

Details

This function sends a request to the given API endpoint and parses the response to extract topic information.

Value

A tibble the topics retrieved from the API.

Examples

# Retrieve topics from the default endpoint
topics <- get_topics()