Commit eb32cfec authored by Pauline Maury Laribière's avatar Pauline Maury Laribière
Browse files

adding doc for website and improving demo with agriculture data

parent 05206233
Pipeline #326981 passed with stage
in 11 seconds
......@@ -13,6 +13,7 @@ Dockerfile
environment.yml
example.Rmd
install.R
public/*
requirements.txt
^_pkgdown\.yml$
......
data/* filter=lfs diff=lfs merge=lfs -text
......@@ -20,7 +20,7 @@ image_build:
- image-build
except:
variables:
- $CI_PROJECT_URL == "https://gitlab.com/d6538/fso-metadata-r"
- $CI_PROJECT_URL == "https://gitlab.com/DSCC/fso-metadata-r"
pages:
stage: deploy
......@@ -32,4 +32,4 @@ pages:
- public
only:
variables:
- $CI_PROJECT_URL == "https://gitlab.com/d6538/fso-metadata-r"
- $CI_PROJECT_URL == "https://gitlab.com/DSCC/fso-metadata-r"
......@@ -20,5 +20,6 @@ Imports:
jsonlite,
methods,
rsdmx,
stringr,
testthat
RoxygenNote: 7.1.1
#' Get a codelist based on an identifier
#'
#' @param identifier the codelist's identifier
#' @param server server on which to query API
#' Available are 'i14y' and 'abn'.
#' @param environment environment on which to query API
#' Available are 'PRD', 'ABN', 'TEST', 'QA' and 'DEV'.
#' @param language string for language(s) to return.
#' Available are 'all', 'fr', 'de', 'it', 'en'.
#' If 'all' (default), all languages are returned.
......@@ -15,14 +15,14 @@
#' @return response based on the export format
#' @export
get_codelist <- function(identifier,
server = 'I14Y',
environment = "PRD",
language = "all",
export_format = "SDMX-ML",
version_format = 2.1,
annotations = FALSE) {
api <- api_class(
api_type = "codelist",
server = server,
environment = environment,
id = identifier,
language = language,
export_format = export_format,
......@@ -35,8 +35,8 @@ get_codelist <- function(identifier,
#' Get one level of a nomenclature
#'
#' @param identifier nomenclature's identifier
#' @param server server on which to query API
#' Available are 'i14y' and 'abn'.
#' @param environment environment on which to query API
#' Available are 'PRD', 'ABN', 'TEST', 'QA' and 'DEV'.
#' @param filters additionnal filters
#' @param level_number level to export
#' @param language the language of the response data
......@@ -47,7 +47,7 @@ get_codelist <- function(identifier,
#' (Code, Parent and Name in the selected language)
#' @export
get_nomenclature_one_level <- function(identifier,
server = 'I14Y',
environment = "PRD",
filters = list(),
level_number = 1,
language = "all",
......@@ -59,7 +59,7 @@ get_nomenclature_one_level <- function(identifier,
)
api <- api_class(
api_type = "nomenclature_one_level",
server = server,
environment = environment,
id = identifier,
language = language,
parameters = parameters,
......@@ -72,8 +72,8 @@ get_nomenclature_one_level <- function(identifier,
#' Get multiple levels of a nomenclature (from `level_from` to `level_to`)
#'
#' @param identifier nomenclature's identifier
#' @param server server on which to query API
#' Available are 'i14y' and 'abn'.
#' @param environment environment on which to query API
#' Available are 'PRD', 'ABN', 'TEST', 'QA' and 'DEV'.
#' @param filters additionnal filters
#' @param level_from the 1st level to include
#' @param level_to the last level to include
......@@ -85,7 +85,7 @@ get_nomenclature_one_level <- function(identifier,
#' from `level_from` to `level_to` codes
#' @export
get_nomenclature_multiple_levels <- function(identifier,
server = 'I14Y',
environment = "PRD",
filters = list(),
level_from = 1,
level_to = 2,
......@@ -100,7 +100,7 @@ get_nomenclature_multiple_levels <- function(identifier,
)
api <- api_class(
api_type = "nomenclature_multiple_levels",
server = server,
environment = environment,
id = identifier,
parameters = parameters,
export_format = "CSV"
......
......@@ -2,8 +2,8 @@
#' Api class to make appropriate request based on parameters
#'
#' @field api_type character. The name of the api to call (see url_mapping)
#' @field server server on which to query API
#' Available are 'I14Y' and 'ABN'
#' @field environment environment on which to query API
#' Available are 'PRD', 'ABN', 'TEST', 'QA' and 'DEV'.
#' @field export_format character (default = "JSON"). The export's format
#' Available are CSV, XLSX, SDMX-ML and JSON
#' @field parameters character. Additional request parameters
......@@ -20,7 +20,7 @@ api_class <- setRefClass(
"Api",
fields = list(
api_type = "character",
server = "character",
environment = "character",
export_format = "character",
parameters = "character",
id = "character",
......@@ -30,7 +30,7 @@ api_class <- setRefClass(
),
methods = list(
initialize = function(...,
server = 'I14Y',
environment = "PRD",
export_format = "JSON",
parameters = "",
id = "",
......@@ -38,7 +38,7 @@ api_class <- setRefClass(
version_format = 2.1) {
callSuper(
...,
server = server,
environment = environment,
export_format = export_format,
parameters = parameters,
id = id,
......@@ -61,11 +61,13 @@ api_class <- setRefClass(
},
get_response = function() {
# API call to url
url <- glue::glue("{SERVERS[[server]]}/api/{api_url}?{parameters}")
url <- glue::glue("{ENVIRONMENTS[[environment]]}/api/{api_url}?{parameters}")
res <- REQUEST_FUNCTION_MAPPING[[export_format]](url)
# If specified language, keep only language specific columns
if(language != "all") { res <- remove_other_languages(res, language) }
if (language != "all") {
res <- remove_other_languages(res, language)
}
res
}
......@@ -83,5 +85,5 @@ remove_other_languages <- function(df, language) {
to_remove <- glue::glue(
"[.|_]+({paste(LANGUAGES[LANGUAGES != language], collapse = '|')})$"
)
df[, ! names(df) %in% names(df)[stringr::str_detect(names(df), to_remove)]]
df[, !names(df) %in% names(df)[stringr::str_detect(names(df), to_remove)]]
}
# Root URL constants¨
SERVERS <- list(
"I14Y" = "https://www.i14y.admin.ch",
"ABN" = "iop-a.app.cfap02.atlantica.admin.ch"
# Root URL constants
ENVIRONMENTS <- list(
"PRD" = "https://www.i14y.admin.ch",
"ABN" = "iop-a.app.cfap02.atlantica.admin.ch",
"TEST" = "iop-t.app.cfap02.atlantica.admin.ch",
"QA" = "iop-q.app.cfap02.atlantica.admin.ch",
"DEV" = "iop-d.app.cfap02.atlantica.admin.ch"
)
LANGUAGES <- c('en', 'de', 'fr', 'it')
# Possible languages
LANGUAGES <- c("en", "de", "fr", "it")
......@@ -24,7 +24,7 @@ json_request <- function(url) {
#'
#' @return dataframe response
csv_request <- function(url) {
read.csv(url)
read.csv(url, encoding = "UTF-8")
}
# Request function based on expected response
......@@ -55,4 +55,3 @@ list_to_string <- function(filters) {
}
string
}
......@@ -10,7 +10,8 @@ This public library is made available for the internal FSO staff, the federal ad
You can install the library with
```
devtools::install_url("https://renkulab.io/gitlab/dscc/metadata-auto-r-library/-/archive/v002/metadata-auto-r-library-v002.tar.gz")
install.packages("remotes")
remotes::install_gitlab("DSCC/fso-metadata-r")
```
then at the beginning of your R script, you will need to
......@@ -25,11 +26,15 @@ Based on the metadata that you want, you will call certain functions and paramet
### Codelists
1. Export a codelist based on an identifier
```
codelist <- get_codelist(identifier, export_format, version_format, annotations)
codelist <- get_codelist(identifier, environment, language, export_format, version_format, annotations)
```
Parameters:
- identifier ("character"): the codelist's identifier
- environment ("character", default="PRD" for production)
Available are 'PRD', 'ABN', 'TEST', 'QA' and 'DEV'.
- language ("character", default="all" for all languages, no filtering)
Available are 'all', 'fr', 'de', 'it', 'en'.
- export_format ("character", default="SDMX-ML"): the export's format.
Available are CSV, XLSX, SDMX-ML or SDMX-JSON.
- version_format ("numeric", default=2.1): the export format's version
......@@ -45,11 +50,13 @@ codelist <- get_codelist(identifier, export_format, version_format, annotations)
1. Export one level of a nomenclature
```
one_level_df <- get_nomenclature_one_level(identifier, level_number, filters, language, annotations)
one_level_df <- get_nomenclature_one_level(identifier, environment, level_number, filters, language, annotations)
```
Parameters:
- identifier ("character"): nomenclature's identifier
- environment ("character", default="PRD" for production)
Available are 'PRD', 'ABN', 'TEST', 'QA' and 'DEV'.
- level_number ("numeric"): level to export
- filter (list): additionnal filters in form of named list
- language ("character", default='fr'): response data's language
......@@ -62,11 +69,13 @@ one_level_df <- get_nomenclature_one_level(identifier, level_number, filters, la
2. Export multiple levels of a nomenclature (from `level_from` to `level_to`)
```
multiple_levels_df = get_nomenclature_multiple_levels(identifier, level_from, level_to, filters, language, annotations)
multiple_levels_df = get_nomenclature_multiple_levels(identifier, environment, level_from, level_to, filters, language, annotations)
```
Parameters:
- identifier ("character"): nomenclature's identifier
- environment ("character", default="PRD" for production)
Available are 'PRD', 'ABN', 'TEST', 'QA' and 'DEV'.
- level_from ("numeric"): the 1st level to include
- level_to ("numeric"): the last level to include
- filter (list): additionnal filters in form of named list
......@@ -103,4 +112,6 @@ All the APIs made available in this library are also documented in Swagger UI sh
Examples for each API are provided in the [R Markdown](https://renkulab.io/gitlab/dscc/metadata-auto-r-library/-/blob/master/example.Rmd).
A documentation page is also available [here](https://d6538.gitlab.io/fso-metadata-r/).
Practical [demo](https://renkulab.io/gitlab/dscc/metadata-auto-r-library/-/blob/master/demo.R).
A documentation page is also available [here](https://DSCC.gitlab.io/fso-metadata-r/).
File added
install.packages("remotes")
remotes::install_gitlab("DSCC/fso-metadata-r")
### Preparation ###
devtools::install_url("https://renkulab.io/gitlab/dscc/metadata-auto-r-library/-/archive/v002/metadata-auto-r-library-v002.tar.gz")
library(fso.metadata)
library(ggplot2)
library(tidyverse)
### 1. Get a codelist ###
# All languages
codelist <- get_codelist(identifier='CL_NOGA_SECTION')
codelist <- get_codelist(identifier = "CL_NOGA_DIVISION")
head(codelist, 3)
### 1. Get a codelist ###
# In french
codelist_fr <- get_codelist(identifier='CL_NOGA_SECTION', language='fr')
codelist_fr <- get_codelist(identifier = "CL_NOGA_SECTION", language = "fr")
head(codelist_fr, 3)
# In german
codelist_de <- get_codelist(identifier = "CL_NOGA_SECTION", language = "de")
head(codelist_de, 3)
### 2. Get a nomenclature of one level ###
# All language: Level 1
nomenclature <- get_nomenclature_one_level(
identifier='HCL_CH_ISCO_19_PROF',
level_number=2
)
head(nomenclature, 3)
# French: Level 2
nomenclature_fr <- get_nomenclature_one_level(
identifier='HCL_CH_ISCO_19_PROF',
level_number=1,
language='fr'
### 2. Get a nomenclature of multiple levels ###
# In italian
multi_nomenclature_it <- get_nomenclature_multiple_levels(
identifier = "HCL_CH_ISCO_19_PROF",
level_from = 1,
level_to = 6,
language = "it"
)
head(nomenclature_fr, 5)
head(multi_nomenclature_it, 8)
### 3. Concrete example from Mr. van Nieuwkoop with Noga Data
library(ggplot2)
library(tidyverse)
# Load the production account data for the agriculture divisions
load("data/pk_agr.Rdata")
pk_agr <- rename(pk_agr, Component = Komponent, Year = Jahr)
head(pk_agr)
### 3. Get a nomenclature of multiple levels ###
# French
multi_nomenclature_fr <- get_nomenclature_multiple_levels(
identifier='HCL_CH_ISCO_19_PROF',
level_from=1,
level_to=6,
language='fr'
# Load the descriptions of the NOGA divisions
noga2 <- as_tibble(
get_codelist(identifier='CL_NOGA_DIVISION', language='fr')
)
head(multi_nomenclature_fr, 10)
names(noga2) <- c("id", "label", "name")
head(noga2)
# Join the production account data with the noga2 descriptions
pk <- pk_agr %>%
left_join(noga2, by = c("Code" = "id")) %>%
select(-name) %>%
relocate(label, .after = Code) %>%
rename(Department = label)
head(pk)
# Plot the intermediate consumption (CI), the value added (VA), and the
# production value (VP) for the section A (agriculture)
pk %>%
select(Code, Department, Component, Year, Nominal) %>%
filter(Nominal > 0 & !is.na(Department)) %>%
ggplot(aes(Year, Nominal, color = Component)) +
geom_line() +
ylab("in Mio. CHF") +
facet_wrap(~Department, scales = "free")
### 4. Concrete example from Mr. van Nieuwkoop with Noga Data
load("data/pkagg.Rdata")
head(pk_agg$A88)
noga2 <- as_tibble(get_codelist(identifier='CL_NOGA_DIVISION', language='it'))
names(noga2) <- c('id', 'label', 'name')
head(noga2)
# Get the completely disaggregated production accounts
# and join them with the noga2 descriptions
a88 <- pk_agg$A88 %>%
left_join(noga2, by = c("Code" = "id"))
head(a88)
plot_agriculture <- function(pk_agr, language) {
# Load the descriptions of the NOGA divisions
noga2 <- as_tibble(
get_codelist(
identifier='CL_NOGA_DIVISION',
language=language,
environment='ABN') # for the demo, only available within network
)
names(noga2) <- c("id", "label", "name")
# Filter and prepare data
a88_filtered <- a88 %>%
select(-Beschreibung, -name) %>%
# Join the production account data with the noga2 descriptions
pk <- pk_agr %>%
left_join(noga2, by = c("Code" = "id")) %>%
select(-name) %>%
relocate(label, .after = Code) %>%
rename(Department = label, Year = Jahr, Component = Komponent) %>%
select(Code, Department, Component, Year, Nominal) %>%
filter( Nominal > 0) %>%
filter(!is.na(Department)) %>% # keep
filter(Code %in% c("01","02", "03")) # keep first 3 department
rename(Department = label)
# Plot the intermediate consumption (CI), the value added (VA), and the
# production value (VP) for the section A (agriculture)
ggplot(a88_filtered, aes(Year, Nominal, color = Component)) +
# Plot the intermediate consumption (CI), the value added (VA), and the
# production value (VP) for the section A (agriculture)
pk %>%
select(Code, Department, Component, Year, Nominal) %>%
filter(Nominal > 0 & !is.na(Department)) %>%
ggplot(aes(Year, Nominal, color = Component)) +
geom_line() +
ylab("in Mio. CHF") +
facet_wrap(~Department, scales = "free")
}
plot_agriculture(pk_agr, language='fr')
plot_agriculture(pk_agr, language='de')
plot_agriculture(pk_agr, language='it')
plot_agriculture(pk_agr, language='en')
......@@ -14,7 +14,8 @@ knitr::opts_chunk$set(echo = TRUE)
You can install the library with
```{r install}
devtools::install_url("https://renkulab.io/gitlab/dscc/metadata-auto-r-library/-/archive/v002/metadata-auto-r-library-v002.tar.gz")
install.packages("remotes")
remotes::install_gitlab("DSCC/fso-metadata-r")
```
then at the beginning of your R script, you will need to
......@@ -43,7 +44,7 @@ my_filters <- list(
```{r , echo=FALSE}
res <- get_nomenclature_one_level(identifier='HCL_CH_ISCO_19_PROF', filters=my_filters, level_number=2, language='fr')
names(res)
head(res)
```
```{r , echo=FALSE}
......
......@@ -13,6 +13,9 @@ Api class to make appropriate request based on parameters
\describe{
\item{\code{api_type}}{character. The name of the api to call (see url_mapping)}
\item{\code{environment}}{environment on which to query API
Available are 'PRD', 'ABN', 'TEST', 'QA' and 'DEV'.}
\item{\code{export_format}}{character (default = "JSON"). The export's format
Available are CSV, XLSX, SDMX-ML and JSON}
......@@ -20,8 +23,8 @@ Available are CSV, XLSX, SDMX-ML and JSON}
\item{\code{id}}{character. The identifier or id of the request's object}
\item{\code{language}}{character (default = "en"). Language of the response data.
Available are 'fr', 'de', 'it', 'en'}
\item{\code{language}}{character (default = "all"). Language of the response data.
Available are 'all', 'fr', 'de', 'it', 'en'}
\item{\code{version_format}}{numeric (default = 2.1). The export format's version
(2.0 or 2.1 when format is SDMX-ML)
......
......@@ -6,7 +6,8 @@
\usage{
get_codelist(
identifier,
language = "fr",
environment = "PRD",
language = "all",
export_format = "SDMX-ML",
version_format = 2.1,
annotations = FALSE
......@@ -15,8 +16,12 @@ get_codelist(
\arguments{
\item{identifier}{the codelist's identifier}
\item{language}{string for language to return.
Available are 'fr', 'de', 'it', 'en'.}
\item{environment}{environment on which to query API
Available are 'PRD', 'ABN', 'TEST', 'QA' and 'DEV'.}
\item{language}{string for language(s) to return.
Available are 'all', 'fr', 'de', 'it', 'en'.
If 'all' (default), all languages are returned.}
\item{export_format}{the export's format
Available are CSV, XLSX, SDMX-ML or JSON.}
......
......@@ -6,6 +6,7 @@
\usage{
get_nomenclature_multiple_levels(
identifier,
environment = "PRD",
filters = list(),
level_from = 1,
level_to = 2,
......@@ -16,6 +17,9 @@ get_nomenclature_multiple_levels(
\arguments{
\item{identifier}{nomenclature's identifier}
\item{environment}{environment on which to query API
Available are 'PRD', 'ABN', 'TEST', 'QA' and 'DEV'.}
\item{filters}{additionnal filters}
\item{level_from}{the 1st level to include}
......
......@@ -6,15 +6,19 @@
\usage{
get_nomenclature_one_level(
identifier,
environment = "PRD",
filters = list(),
level_number = 1,
language = "fr",
language = "all",
annotations = FALSE
)
}
\arguments{
\item{identifier}{nomenclature's identifier}
\item{environment}{environment on which to query API
Available are 'PRD', 'ABN', 'TEST', 'QA' and 'DEV'.}
\item{filters}{additionnal filters}
\item{level_number}{level to export}
......
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/api_class.R
\name{remove_other_languages}
\alias{remove_other_languages}
\title{Remove columns that belong to other languages than the selected one}
\usage{
remove_other_languages(df, language)
}
\arguments{
\item{df}{data.frame returned from API with columns for all languages}
\item{language}{language to keep}
}
\value{
dataframe with columns relevant to selected language only
}
\description{
Remove columns that belong to other languages than the selected one
}
......@@ -71,7 +71,8 @@
<h2 class="hasAnchor">
<a href="#installation" class="anchor"></a>Installation</h2>
<p>You can install the library with</p>
<pre><code><a href="https://devtools.r-lib.org/reference/remote-reexports.html">devtools::install_url("https://renkulab.io/gitlab/dscc/metadata-auto-r-library/-/archive/v002/metadata-auto-r-library-v002.tar.gz")</a></code></pre>
<pre><code><a href="https://rdrr.io/r/utils/install.packages.html">install.packages("remotes")
remotes::install_gitlab("dscc/fso-metadata-r")</a></code></pre>
<p>then at the beginning of your R script, you will need to</p>
<pre><code><a href="https://renkulab.io/gitlab/dscc/metadata-auto-r-library">library("fso.metadata")</a></code></pre>
</div>
......@@ -85,18 +86,22 @@
<ol>
<li>Export a codelist based on an identifier</li>
</ol>
<pre><code>codelist &lt;- get_codelist(identifier, export_format, version_format, annotations)</code></pre>
<pre><code>codelist &lt;- get_codelist(identifier, environment, language, export_format, version_format, annotations)</code></pre>
<div class="sourceCode" id="cb4"><pre class="sourceCode R"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>Parameters<span class="sc">:</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="sc">-</span> <span class="fu">identifier</span> (<span class="st">"character"</span>)<span class="sc">:</span> the codelist<span class="st">'s identifier</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="st"> - export_format ("character", default="SDMX-ML"): the export'</span>s format. </span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> Available are CSV, XLSX, SDMX<span class="sc">-</span>ML or SDMX<span class="sc">-</span>JSON.</span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="sc">-</span> <span class="fu">version_format</span> (<span class="st">"numeric"</span>, <span class="at">default=</span><span class="fl">2.1</span>)<span class="sc">:</span> the export format<span class="st">'s version </span></span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a><span class="st"> (2.0 or 2.1 when format is SDMX-ML).</span></span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a><span class="st"> - annotations (bool, default=FALSE): flag to include annotations</span></span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a><span class="st">Returns:</span></span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a><span class="st"> - codelist (data.frame) based on the export format</span></span>
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a><span class="st"> - a data.frame if export_format was CSV or XLSX</span></span>
<span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a><span class="st"> - a json if export_format was SDMX-ML or SDMX-JSON.</span></span></code></pre></div>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="st"> - environment ("character", default="PRD" for production)</span></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="st"> Available are '</span>PRD<span class="st">', '</span>ABN<span class="st">', '</span>TEST<span class="st">', '</span>QA<span class="st">' and '</span>DEV<span class="st">'.</span></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a><span class="st"> - language ("character", default="all" for all languages, no filtering)</span></span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a><span class="st"> Available are '</span>all<span class="st">', '</span>fr<span class="st">', '</span>de<span class="st">', '</span>it<span class="st">', '</span>en<span class="st">'.</span></span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a><span class="st"> - export_format ("character", default="SDMX-ML"): the export'</span>s format. </span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a> Available are CSV, XLSX, SDMX<span class="sc">-</span>ML or SDMX<span class="sc">-</span>JSON.</span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a> <span class="sc">-</span> <span class="fu">version_format</span> (<span class="st">"numeric"</span>, <span class="at">default=</span><span class="fl">2.1</span>)<span class="sc">:</span> the export format<span class="st">'s version </span></span>
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a><span class="st"> (2.0 or 2.1 when format is SDMX-ML).</span></span>
<span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a><span class="st"> - annotations (bool, default=FALSE): flag to include annotations</span></span>
<span id="cb4-12"><a href="#cb4-12" aria-hidden="true" tabindex="-1"></a><span class="st">Returns:</span></span>
<span id="cb4-13"><a href="#cb4-13" aria-hidden="true" tabindex="-1"></a><span class="st"> - codelist (data.frame) based on the export format</span></span>
<span id="cb4-14"><a href="#cb4-14" aria-hidden="true" tabindex="-1"></a><span class="st"> - a data.frame if export_format was CSV or XLSX</span></span>
<span id="cb4-15"><a href="#cb4-15" aria-hidden="true" tabindex="-1"></a><span class="st"> - a json if export_format was SDMX-ML or SDMX-JSON.</span></span></code></pre></div>
</div>
<div id="nomenclatures" class="section level3">
<h3 class="hasAnchor">
......@@ -104,31 +109,35 @@
<ol>
<li>Export one level of a nomenclature</li>
</ol>
<pre><code>one_level_df &lt;- get_nomenclature_one_level(identifier, level_number, filters, language, annotations)</code></pre>
<pre><code>one_level_df &lt;- get_nomenclature_one_level(identifier, environment, level_number, filters, language, annotations)</code></pre>
<div class="sourceCode" id="cb6"><pre class="sourceCode R"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a>Parameters<span class="sc">:</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="sc">-</span> <span class="fu">identifier</span> (<span class="st">"character"</span>)<span class="sc">:</span> nomenclature<span class="st">'s identifier</span></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="st"> - level_number ("numeric"): level to export</span></span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a><span class="st"> - filter (list): additionnal filters in form of named list</span></span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a><span class="st"> - language ("character", default='</span>fr<span class="st">'): response data'</span>s language </span>
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a> Available are <span class="st">'fr'</span>, <span class="st">'de'</span>, <span class="st">'it'</span>, <span class="st">'en'</span>.</span>
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a> <span class="sc">-</span> <span class="fu">annotations</span> (bool, <span class="at">default=</span><span class="cn">FALSE</span>)<span class="sc">:</span> flag to include annotations</span>
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a>Returns<span class="sc">:</span></span>
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a> <span class="sc">-</span> <span class="fu">response</span> (data.frame)<span class="sc">:</span> dataframe with <span class="dv">3</span> columns </span>
<span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a> (Code, Parent and Name <span class="cf">in</span> the selected language)</span></code></pre></div>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="st"> - environment ("character", default="PRD" for production)</span></span>