---
title: >
  I14Y: An R package to access data from the Interoperability Platform of Switzerland
author:
  - name: Félix Luginbühl
    affiliation: 1
    extra:
      - "www.felixluginbuhl.com"
affiliation:
  - Fachstelle für Statistik Kanton SG.
date: "2025-06-12"
output:
  # devtools::install_github("gerkelab/betterposter")
  betterposter::poster_better:
    # Optional styling arguments
    hero_background: "#DA291C"
    accent_color: "#444444"
    hero_color: "#FFFFFF"
    #logo: "https://felixluginbuhl.com/I14Y/logo.png"
    # See betterposter::qrcode_options() for help
    qrcode:
      text: "https://felixluginbuhl.com/I14Y"
      size: "350"
    mathjax: false
    # Generic rmarkdown arguments
    highlight: tango
    self_contained: true
draft: true
---

```{r load_packages, message=FALSE, warning=FALSE, include=FALSE} 
library(fontawesome)
```

```{css echo=FALSE}
/* Adjust space at top of #hero (center panel) */
#hero {
  padding-top: 17%;
}

#hero h1 {
  font-size: 4.5em; /* 3.25em; */
  text-align: center;
}
```


<div id="hero">
<!--
  Center Column of Poster
  * The main text goes in <h1> (single #) header.
  * You can add additional text if desired.
-->

<h1>Search and download <b style="font-size:1.1em">I14Y data</b><br> in multiple languages <br><b>with 1 line of code</b></h1>

<br>

<h3>Access the full documentation: www.felixluginbuhl.com/I14Y</h3>

<h3>Let's get in touch:</h3>

<h4>
- `r fa("envelope", fill = "white")` &ensp;&ensp; felix.luginbuhl@outlook.com
- `r fa("linkedin", fill = "white")` &ensp;&ensp; linkedin.com/in/felixluginbuhl
- `r fa("globe", fill = "white")` &ensp;&ensp; www.felixluginbuhl.com
</h4>

</div>



<div id="left-bar">
<!-- Text in the left bar, title and authors added automatically -->

## Abstract

I14Y allows to search and download official Swiss metadata from the Interoperability Platform of Switzerland using its public IOP API and Console API in multiple languages: English (“en”), German (“de”), French (“fr”) or Italian (“it”).

## Install and load

``` r
install.packages("I14Y")
library(I14Y)
```

## Get concepts and codelists

Search for a concept in a given language (“en”, “de”, “fr” or “it”):

``` r
i14y_search_concept(search = "noga", language = "en")
```

    #> # A tibble: 10 × 13
    #>    conceptType id        identifier registrationStatus validFrom
    #>    <chr>       <chr>     <chr>      <chr>              <chr>
    #>  1 CodeList    08d94604… DV_NOGA_C… PreferredStandard  2007-12-…
    #>  2 CodeList    08d94604… DV_NOGA_D… PreferredStandard  2007-12-…
    #>  3 CodeList    08d9f6dd… DV_NOGA_E… Recorded           2007-12-…
    #>  4 CodeList    08d94604… DV_NOGA_G… PreferredStandard  2007-12-…
    #>  5 CodeList    08d94604… DV_NOGA_O… Recorded           2007-12-… 
    #> # ℹ 6 more variables: agencyName.cultureCode <chr>, agencyName.text,
    #> #   description.cultureCode <chr>, description.text <chr>,
    #> #   name.cultureCode <chr>, name.text <chr>

You can also get a concept metadata using `i14_get_concept()`:

```r
concept_list <- i14y_get_concept(
  id = "08d94604-e058-62a2-aa25-53f84b974201"
)
```

## Search and get datasets

Search in the public catalog for datasets, data services or public services:

```r
i14y_search_catalog()
```

    #> # A tibble: 140 × 13
    #>    formats   identifier   registrationStatus themes type  accessRights…¹
    #>    <list>    <chr>        <chr>              <list> <chr> <chr>                 
    #>  1 <chr [0]> 0aaed69d-15… Recorded           <df>   Data… de                    
    #>  2 <chr [0]> 15d720d4-dc… Recorded           <df>   Data… de                    
    #>  3 <chr [0]> 14e60ad3-1c… Recorded           <df>   Data… de                    
    #>  4 <chr [0]> 1f975f0e-68… Recorded           <df>   Data… de                    
    #>  5 <chr [0]> 08b7a45f-c1… Recorded           <df>   Data… de                    
    #> # ℹ 135 more rows
    #> # ℹ abbreviated name: ¹​accessRights.cultureCode
    #> # ℹ 7 more variables: accessRights.text <chr>, description.cultureCode,
    #> #   description.text <chr>, publisher.cultureCode <chr>, publisher.text,
    #> #   title.cultureCode <chr>, title.text <chr>

Get a nomenclature dataset level with `i14y_get_nomenclature_level()`.

```r
i14y_get_nomenclature_level(
  identifier = "HCL_NOGA",
  level = 2,
  language = "de"
)
```

Similarly you can access multi-levels nomenclature data:

```r
i14y_get_nomenclature_level_multiple(
  identifier = "HCL_NOGA",
  levelFrom = 1,
  levelTo = 2,
  language = "de"
)
```

## Data structure

Search for data structure, for example for a SpiGes dataset:

```r
i14y_search_catalog(query = "SpiGes")
```

    #> # A tibble: 15 × 13
    #>    formats    identifier  registrationStatus themes type  accessRights…¹
    #>    <list>     <chr>       <chr>              <list> <chr> <chr>                 
    #>  1 <list [0]> SpiGes_Erh… Recorded           <df>   Data… de                    
    #>  2 <list [0]> SpiGes_Erh… Recorded           <df>   Data… de                    
    #>  3 <list [0]> SpiGes_Erh… Recorded           <df>   Data… de                    
    #>  4 <list [0]> SpiGes_Erh… Recorded           <df>   Data… de                    
    #>  5 <list [0]> SpiGes_Erh… Recorded           <df>   Data… de                    
    #> # ℹ 10 more rows
    #> # ℹ abbreviated name: ¹​accessRights.cultureCode
    #> # ℹ 7 more variables: accessRights.text <chr>, description.cultureCode,
    #> #   description.text <chr>, publisher.cultureCode <chr>, publisher.text,
    #> #   title.cultureCode <chr>, title.text <chr>

You can get its data structure with `i14y_get_data_structure()`:

```r
i14y_get_data_structure(identifier = "SpiGes_Erhebung_Administratives")
```

</div>

<div id="right-bar">
<!-- Right bar -->

## A concrete example

When using an official Swiss dataset, you can use I14Y to get translations or additional information for a given category. 

Let’s download the monthly income by gender and profession in 2022 using the **BFS** R package.

```r
install.packages("BFS")
library(BFS)

income_by_job_and_gender_meta <- BFS::bfs_get_metadata(
  number_bfs = "px-x-0304010000_201"
)

income_by_job_and_gender <- BFS::bfs_get_data(
  number_bfs = "px-x-0304010000_201", 
  language = "de",
  query = list(
    Jahr = "2022", 
    Geschlecht = c("1", "2"),
    Wirtschaftsabteilung = income_by_job_and_gender_meta$values[[3]],
    'Zentralwert und andere Perzentile' = "1"
  )
)

income_by_job_and_gender
```

    #> # A tibble: 164 × 5
    #>    Jahr  Wirtschaftsabteilung                  Geschlecht Zentralwert…¹
    #>    <chr> <chr>                                 <chr>      <chr>                 
    #>  1 2022  Wirtschaftsabteilung - Total          Frauen     Zentralwert           
    #>  2 2022  Wirtschaftsabteilung - Total          Männer     Zentralwert           
    #>  3 2022  05-43 Sektor 2: Produktion            Frauen     Zentralwert           
    #>  4 2022  05-43 Sektor 2: Produktion            Männer     Zentralwert           
    #>  5 2022  > 8 Gewinnung von Steinen und Erden,… Frauen     Zentralwert           
    #>  6 2022  > 8 Gewinnung von Steinen und Erden,… Männer     Zentralwert           
    #>  7 2022  > 9 Erbringung von Dienstleistungen … Frauen     Zentralwert           
    #>  8 2022  > 9 Erbringung von Dienstleistungen … Männer     Zentralwert           
    #>  9 2022  > 10 Herstellung von Nahrungs- und F… Frauen     Zentralwert           
    #> 10 2022  > 10 Herstellung von Nahrungs- und F… Männer     Zentralwert           
    #> # ℹ 154 more rows
    #> # ℹ abbreviated name: ¹​`Zentralwert und andere Perzentile`
    #> # ℹ 1 more variable: `Monatlicher Bruttolohn` <dbl>


Using I14Y, you can get the English, French or Italian translation of the German NOGA division categories (with a bit of extra data transformations):

```r
library(dplyr)
library(stringr)
library(readr)

noga_division <- i14y_get_codelist(
  id = "08d94604-e058-62a2-aa25-53f84b974201" # for DV_NOGA_DIVISION
) |>
  mutate(Code = as.numeric(Code))

income_by_job_and_gender |>
  filter(!str_detect(Wirtschaftsabteilung, "Sektor")) |> # remove sectors
  mutate(Code = parse_number(Wirtschaftsabteilung)) |> # extract code
  left_join(noga_division, by = "Code") |>
  select(Wirtschaftsabteilung, Name_en, Name_fr, Name_it)
```

    #> # A tibble: 160 × 4
    #>    Wirtschaftsabteilung                                  Name_en Name_fr
    #>    <chr>                                                 <chr>   <chr> 
    #>  1 Wirtschaftsabteilung - Total                          <NA>    <NA>
    #>  2 Wirtschaftsabteilung - Total                          <NA>    <NA>
    #>  3 > 8 Gewinnung von Steinen und Erden, sonstiger Bergb… Other … Autres…
    #>  4 > 8 Gewinnung von Steinen und Erden, sonstiger Bergb… Other … Autres…
    #>  5 > 9 Erbringung von Dienstleistungen für den Bergbau … Mining… Servic…
    #>  6 > 9 Erbringung von Dienstleistungen für den Bergbau … Mining… Servic…
    #>  7 > 10 Herstellung von Nahrungs- und Futtermitteln      Manufa… Indust…
    #>  8 > 10 Herstellung von Nahrungs- und Futtermitteln      Manufa… Indust…
    #>  9 > 11 Getränkeherstellung                              Manufa… Fabric…
    #> 10 > 11 Getränkeherstellung                              Manufa… Fabric…
    #> # ℹ 150 more rows

## The SwissStatsR universe

The **I14Y** R package is listed in the SwissStatsR Universe.

On the platform, you can find other R packages related to Swiss statistics such as:

- **BFS**: Search and Get Data from the Swiss Federal Statistical Office
- **dcatapchr**:	Create DCAT-AP CH Metadata Files
- **distrr**:	Estimate and Manage Empirical Distributions
- **eneRgyVD**:	Municipal statistics for climate-related policies in Canton Vaud
- **ghactionsOGD**:	Easy GitHub Actions workflows for data-retrieving processes
- **impexpcsv**: Import Various csv Files and Export in One csv file
- **noga**: Recode according to NOGA 2008
- **propop**: Project Swiss Population Growth using the Cohort Component Method
- **seasonal**:	R Interface to X-13-ARIMA-SEATS
- **sgtourism**:	St.Gallen Tourism Dashboard
- **SpiGesXML**:	Extract data from SpiGes XML files
- **zuericolors**: Statistik Stadt Zuerich Colors
- **zueriplots**: Create ggplots with styling according to the city of Zurich
- **zueritheme**:	ggplot theme to conform to the design of the city of Zurich
- **zueriverse**: All information about zueriverse packages in one place

SwissstatsR is the collaboration platform of the R working group within CORSTAT/KORSTAT, the Swiss Conference of regional statistical offices. The group comprises employees of 16 statistical offices of Switzerland. It was initiated by the Statistical Offices of Canton of St.Gallen and Canton of Zürich.

The SwissStatsR platform is accessible here: [https://swissstatsr.org/](https://swissstatsr.org/)


</div>
