
Retrieve INSEE series from INSEE SDMX web service
retrieve_insee_serie.RdThis function downloads main information on series data from the INSEE SDMX web service. It retrieves available dataflow, filters them based on the specified category, and then fetches series keys from the XML structure.
Arguments
- destination
character, destination directory for the downloaded file. Default to
tempdir()- category
A character string indicating the category of series to download. Defaults to "agriculture". Setting this to
NULLwill attempt to download information for all INSEE series.- by
character, in which column should the
categorybe found. should be one ofnames(get_insee_dataflow()). One of c("label", "id").- output_prefix
character, prefix that should be given to output file. Default to "insee_index".
- retrieve
boolean, should the result be returned. Default to
FALSE.- verbose
A logical value indicating whether to print messages during the process. Defaults to
TRUE.
Value
If retrieve = TRUE, a list of data.frames containing the series keys. The exact columns will depend on the data available from INSEE, but generally represent attributes of the series.
Details
The function retrieves a list of all available dataflow from the INSEE SDMX
web service using the get_insee_dataflow(). If a category is specified,
the dataflow are further filtered to include only those matching the
specified category. Finally, it iterates through the unique IDs of the
filtered dataflow, retrieves the series structure using
get_serie_structure(), extracts the series keys from the XML structure
using get_serie_key_from_xml() and returns a data frame containing these
keys.
Examples
if (FALSE) { # \dontrun{
# Download agricultural series data
agri_series = retrieve_insee_serie(
category = "agriculture",
retrieve = TRUE
)
print(head(agri_series))
# Download all INSEE series data (may take a long time)
all_series = retrieve_insee_serie(category = NULL, verbose = FALSE)
print(head(all_series))
} # }