Skip to content

Commit caf15c8

Browse files
committed
Dev version 4.1.0.9006: Remove experimental functions, fix tests
1 parent 363da2c commit caf15c8

19 files changed

+37
-366
lines changed

DESCRIPTION

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Type: Package
22
Package: eurostat
33
Title: Tools for Eurostat Open Data
4-
Version: 4.1.0.9005
5-
Date: 2025-10-16
4+
Version: 4.1.0.9006
5+
Date: 2025-11-06
66
Authors@R: c(
77
person("Leo", "Lahti", , "leo.lahti@iki.fi", role = c("aut", "cre"),
88
comment = c(ORCID = "0000-0001-5537-637X")),
@@ -20,6 +20,7 @@ Authors@R: c(
2020
person("Oliver", "Reiter", role = "ctb"),
2121
person("Pyry", "Kantanen", role = "aut",
2222
comment = c(ORCID = "0000-0003-2853-2765")),
23+
person("Akewak", "Jeba", role = "ctb"),
2324
person("Enrico", "Spinielli", , "enrico.spinielli@gmail.com", role = "ctb",
2425
comment = c(ORCID = "0000-0001-8584-9131"))
2526
)
@@ -52,8 +53,7 @@ Imports:
5253
tibble,
5354
tidyr (>= 1.0.0),
5455
xml2,
55-
data.table (>= 1.14.8),
56-
dataset (>= 0.4.0)
56+
data.table (>= 1.14.8)
5757
Suggests:
5858
giscoR,
5959
knitr,

NAMESPACE

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export(eurotime2date)
99
export(eurotime2num)
1010
export(get_bibentry)
1111
export(get_eurostat)
12-
export(get_eurostat_async)
1312
export(get_eurostat_dic)
1413
export(get_eurostat_folder)
1514
export(get_eurostat_geospatial)
@@ -37,15 +36,12 @@ importFrom(ISOweek,ISOweek2date)
3736
importFrom(classInt,classIntervals)
3837
importFrom(countrycode,countrycode)
3938
importFrom(curl,curl_download)
40-
importFrom(data.table,"%chin%")
4139
importFrom(data.table,":=")
4240
importFrom(data.table,.SD)
4341
importFrom(data.table,fread)
4442
importFrom(data.table,melt)
4543
importFrom(data.table,setDT)
4644
importFrom(data.table,setcolorder)
47-
importFrom(dataset,dataset_df)
48-
importFrom(dataset,dublincore)
4945
importFrom(digest,digest)
5046
importFrom(dplyr,"%>%")
5147
importFrom(dplyr,case_when)
@@ -64,11 +60,9 @@ importFrom(httr2,req_user_agent)
6460
importFrom(httr2,request)
6561
importFrom(httr2,resp_body_json)
6662
importFrom(httr2,resp_body_raw)
67-
importFrom(httr2,resp_body_xml)
6863
importFrom(httr2,resp_check_status)
6964
importFrom(httr2,resp_content_type)
7065
importFrom(httr2,resp_is_error)
71-
importFrom(httr2,resp_status)
7266
importFrom(httr2,url_build)
7367
importFrom(httr2,url_parse)
7468
importFrom(jsonlite,fromJSON)
@@ -109,8 +103,9 @@ importFrom(utils,person)
109103
importFrom(utils,read.csv)
110104
importFrom(utils,read.delim)
111105
importFrom(utils,toBibtex)
112-
importFrom(utils,unzip)
113106
importFrom(xml2,read_xml)
107+
importFrom(xml2,xml_attr)
114108
importFrom(xml2,xml_find_all)
115109
importFrom(xml2,xml_find_first)
110+
importFrom(xml2,xml_ns)
116111
importFrom(xml2,xml_text)

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# eurostat 4.1.0.9006
2+
3+
## Minor updates
4+
5+
* Removed experimental functions from the codebase, fixed tests that were pointing at datasets renamed by Eurostat
6+
17
# eurostat 4.1.0.9005
28

39
## Deprecated and defunct

R/get_eurostat.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
#' set_eurostat_cache_dir(file.path(tempdir(), "r_cache2"))
143143
#' k <- get_eurostat("nama_10_lp_ulc")
144144
#' k <- get_eurostat("nama_10_lp_ulc", cache = FALSE)
145-
#' k <- get_eurostat("avia_gonc", select_time = "Y", cache = FALSE)
145+
#' k <- get_eurostat("avia_gooc", select_time = "Y", cache = FALSE)
146146
#'
147147
#' dd <- get_eurostat("nama_10_gdp",
148148
#' filters = list(

R/get_eurostat_async.R

Lines changed: 0 additions & 160 deletions
This file was deleted.

R/get_eurostat_sdmx.R

Lines changed: 6 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313
#' what is the best way to interact with SDMX APIs.
1414
#'
1515
#' @inheritParams get_eurostat
16-
#' @inheritParams get_eurostat_async
1716
#' @param agency Either "Eurostat" (default), "Eurostat_comext"
1817
#' (for Comext and Prodcom datasets), "COMP", "EMPL" or "GROW"
1918
#' @param use.data.table Use data.table to process files? Default is FALSE.
2019
#' If data.table is used, data will be downloaded as a TSV file and
2120
#' processed using [tidy_eurostat()]
21+
#' @param wait Integer. Seconds between status checks. Default is 1 second.
22+
#' @param max_wait Integer. Max time to wait in seconds. Default is 60 seconds.
23+
#' @param compressed Logical. Download data in compressed format? Default is TRUE.
2224
#'
2325
#' @importFrom curl curl_download
2426
#' @importFrom utils download.file
@@ -131,7 +133,7 @@ get_eurostat_sdmx <- function(
131133
}
132134

133135
get_sdmx_codelist <- function(codelist_id, agency = "Eurostat", type = "list", lang = NULL) {
134-
lang <- eurostat:::check_lang(lang)
136+
lang <- check_lang(lang)
135137

136138
api_base_uri <- build_api_base_uri(agency)
137139

@@ -170,7 +172,7 @@ get_sdmx_codelist <- function(codelist_id, agency = "Eurostat", type = "list", l
170172

171173
get_sdmx_conceptscheme <- function(id, agency = "Eurostat", type = "list", lang = NULL) {
172174

173-
lang <- eurostat:::check_lang(lang)
175+
lang <- check_lang(lang)
174176

175177
api_base_uri <- build_api_base_uri(agency)
176178

@@ -223,6 +225,7 @@ get_sdmx_conceptscheme <- function(id, agency = "Eurostat", type = "list", lang
223225
return(metadata_returnable)
224226
}
225227

228+
#' @importFrom xml2 xml_ns xml_find_first xml_text xml_attr xml_find_all
226229
get_sdmx_dsd <- function(id, agency = "Eurostat", type = "list", lang = NULL) {
227230
api_base_uri <- build_api_base_uri(agency)
228231

@@ -649,84 +652,3 @@ label_eurostat_sdmx <- function(x, agency, id, lang = "en", verbose = TRUE) {
649652
}
650653
x
651654
}
652-
653-
#' @title Create OM compliant datasets
654-
#' @importFrom dataset dublincore dataset_df
655-
#' @examples
656-
#' enriched_dataset <- om_dataset("nama_10_gdp", lang = "de")
657-
#'
658-
om_dataset <- function(id, agency = "eurostat", lang = "en") {
659-
lang <- check_lang(lang)
660-
661-
df <- get_eurostat_sdmx(id = id, lang = lang, agency = agency, legacy.data.output = FALSE, verbose = FALSE)
662-
663-
dataflow <- eurostat:::get_sdmx_dataflow(id = id, agency = agency, type = "list", lang = lang)
664-
665-
colnames <- names(df)
666-
667-
if ("geo" %in% colnames) {
668-
geo_dict <- get_sdmx_codelist("geo", lang = lang)
669-
geo_names <- unique(geo_dict$name[geo_dict$id %in% df$geo])
670-
if (length(geo_names) > 40) {
671-
coverage = "Europe"
672-
} else {
673-
coverage = paste(unique(geo_names), collapse = ", ")
674-
}
675-
} else {
676-
coverage = "Europe"
677-
}
678-
679-
concept_scheme <- eurostat:::get_sdmx_conceptscheme(id = id, agency = agency, lang = lang)
680-
681-
dsd <- get_sdmx_dsd(id = id, agency = agency, lang = lang)
682-
683-
bibentry <- dataset::dublincore(
684-
title = dataflow$name,
685-
creator = person(given = dataflow$source_institutions, role = "cre"),
686-
publisher = dataflow$source_institutions, # I think the publisher is Eurostat... or maybe European Commission?
687-
datasource = dataflow$doi_url,
688-
rights = "Creative Commons Attribution 4.0 International", # could be shortened to CC-BY 4.0
689-
coverage = coverage,
690-
language = lang)
691-
692-
df_with_metadata <- add_metadata(df, concept_scheme = concept_scheme, dsd = dsd)
693-
694-
dataset_enriched <- dataset::dataset_df(df_with_metadata,
695-
dataset_bibentry = bibentry)
696-
697-
return(dataset_enriched)
698-
}
699-
700-
701-
add_metadata <- function(df, concept_scheme,
702-
dsd) {
703-
704-
# Check required columns in concept_scheme
705-
if (!all(c("id", "name") %in% names(concept_scheme))) {
706-
stop("concept_scheme must contain 'id' and 'name' columns.")
707-
}
708-
709-
# Make sure we can iterate over the names
710-
df_out <- df
711-
712-
for (var in names(df)) {
713-
if (var %in% concept_scheme$id) {
714-
715-
label <- concept_scheme$name[concept_scheme$id == var]
716-
717-
# Construct metadata URIs
718-
concept_uri <- concept_scheme$urn[concept_scheme$id == var]
719-
namespace <- dsd$urn[dsd$id == var]
720-
721-
# Apply defined() dynamically
722-
df_out[[var]] <- dataset::defined(
723-
df[[var]],
724-
label = label,
725-
concept = concept_uri,
726-
namespace = namespace
727-
)
728-
}
729-
}
730-
731-
return(df_out)
732-
}

0 commit comments

Comments
 (0)