| Title: | Download Insee French Institute of Statistics Open Data |
| Version: | 1.1.0 |
| Description: | A wrapper for the French Institute of Statistics (Insee) API Melodi https://catalogue-donnees.insee.fr. Download, search, filter data and metadata from open data statistical public datasets, in french or in english. |
| License: | MIT + file LICENSE |
| URL: | https://InseeFrLab.github.io/melodi/, https://github.com/InseeFrLab/melodi |
| BugReports: | https://github.com/InseeFrLab/melodi/issues |
| Depends: | R (≥ 4.1.0) |
| Imports: | data.table, dplyr, glue, httr2, labelled, magrittr, purrr, stats, tibble, tidyr, zip |
| Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0), vcr (≥ 0.6.0) |
| VignetteBuilder: | knitr |
| Config/roxygen2/version: | 8.0.0 |
| Config/testthat/edition: | 3 |
| Encoding: | UTF-8 |
| Language: | fr |
| NeedsCompilation: | no |
| Packaged: | 2026-07-20 07:46:26 UTC; onyxia |
| Author: | Cédric Bobinec [aut, cre], Christophe Goudeau [aut], Institut national de la statistique et des études économiques [cph] |
| Maintainer: | Cédric Bobinec <cedric.bobinec@insee.fr> |
| Repository: | CRAN |
| Date/Publication: | 2026-07-29 16:40:09 UTC |
Pipe operator
Description
See magrittr::%>% for details.
Usage
lhs %>% rhs
Arguments
lhs |
A value or the magrittr placeholder. |
rhs |
A function call using the magrittr semantics. |
Value
The result of calling rhs(lhs).
Get all data from a dataset
Description
Get all data from a dataset
Usage
get_all_data(
ds_name,
download_directory = tempdir(),
stringsAsFactors = FALSE,
remove_file = TRUE
)
Arguments
ds_name |
Dataset name - use get_ds_list to find a dataset identifier |
download_directory |
Download directory - default system tempdir |
stringsAsFactors |
if TRUE, strings variables in data.frame are converted to factors - Default FALSE |
remove_file |
Remove downloaded data file after loading data
|
Value
data.frame with data
Examples
data <- get_all_data("DS_TICM_PRATIQUES")
Get list of available datasets
Description
Get list of available datasets
Usage
get_catalog(lang = "fr")
Arguments
lang |
lang of metadata informations (default: fr) |
Value
a data.frame containing list of available datasets
Examples
get_catalog()
get_catalog(lang = "en")
Get Melodi data by URL.
Description
URL parameter can be copied/pasted from explorer https://catalogue-donnees.insee.fr
Usage
get_data(url)
Arguments
url |
URL API data Melodi - Start by "https://api.insee.fr/melodi/data/..." |
Value
data.frame with data
Examples
get_data(
"https://api.insee.fr/melodi/data/DS_POPULATIONS_REFERENCE?GEO=FRANCE-F"
)
Get file attached to a dataset : extract (XLSX), or full CSV file
Description
Get file attached to a dataset : extract (XLSX), or full CSV file
Usage
get_file(
ds_name,
file_name,
download_file_name,
download_directory = tempdir()
)
Arguments
ds_name |
Dataset name |
file_name |
File name |
download_file_name |
Filename on disk after download |
download_directory |
Download directory - default system tempdir |
Value
downloaded file name on disk
Examples
get_file(
ds_name = "DS_EC_DECES",
file_name = "T1_DECES_JOUR_NAT_FR",
download_file_name = "T1_DECES_JOUR_NAT_FR.xlsx"
)
Get data on one territory
Description
Get data on one territory
Usage
get_local_data(ds_name, geo, geo_object, filter = "")
Arguments
ds_name |
Dataset name |
geo |
Code geo |
geo_object |
Geo Level |
filter |
additionnal filter on request - default : "" |
Value
data.frame with data
Examples
get_local_data(
ds_name = "DS_POPULATIONS_REFERENCE",
geo = "69",
geo_object = "DEP"
)
get_local_data(
ds_name = "DS_RP_POPULATION_PRINC",
geo = "69",
geo_object = "DEP",
filter = "SEX=F&AGE=Y20T64"
)
Get data on every Commune of one territory
Description
Get data on every Commune of one territory
Usage
get_local_data_by_com(ds_name, geo, geo_object, filter = "")
Arguments
ds_name |
Dataset name |
geo |
Code geo |
geo_object |
Geo Level |
filter |
additionnal filter on request - default : "" |
Value
data.frame with data
Examples
get_local_data_by_com(
ds_name = "DS_POPULATIONS_REFERENCE",
geo = "44",
geo_object = "DEP"
) |>
head()
get_local_data_by_com(
ds_name = "DS_RP_POPULATION_PRINC",
geo = "44",
geo_object = "DEP",
filter = "SEX=F&AGE=Y20T64"
) |>
head()
Get dataset metadata
Description
Get dataset metadata
Usage
get_metadata(ds_name)
Arguments
ds_name |
Dataset name |
Value
list dataset metadata
Examples
get_metadata("DS_POPULATIONS_REFERENCE")
Get dataset range (codes and labels)
Description
Retrieves the list of dimensions and all their possible modalities values (codes and human-readable labels) for a given dataset. For GEO dimension, it is recommanded to used dedicated function : get_range_geo()
Usage
get_range(ds_name, lang = "fr", exclusions_list = c("GEO"))
Arguments
ds_name |
dataset name |
lang |
french or english labels - default french ("fr") |
exclusions_list |
exclude some dimensions for a faster and light result - default : "GEO" |
Value
A data frame with dimensions and modalities codes and labels
Examples
get_range("DS_POPULATIONS_REFERENCE")
get_range(
ds_name = "DS_POPULATIONS_REFERENCE",
lang = "en"
)
get_range(
ds_name = "DS_EC_DECES",
exclusions_list = c("GEO", "TIME_PERIOD")
)
Get dataset's geography : codes and labels
Description
Retrieves the list of geo dimensions and all their possible values (codes and human-readable labels) for a given dataset.
Usage
get_range_geo(ds_name, lang = "fr")
Arguments
ds_name |
dataset name |
lang |
french or english labels - default french ("fr") |
Details
For other dimensions, refer to get_range()
Value
A data frame with columns
GEO_REF, GEO_OBJECT, GEO_OBJECT_LABEL, GEO, GEO_LABEL
Examples
get_range_geo("DS_POPULATIONS_REFERENCE") |>
head()