A curated list of R packages & R code created and used by Swiss public institutions
Mid 2021, we started to collect and classify R packages that are are created and used by Swiss statistical offices to facilitate collaboration and reduce duplication. We presented and discussed this first list on the adminR Session at the Swiss Statistics Meeting 2021 on the 6th of September 2021 in Lugano.
In the meantime, following the adminR-Spring Meetup in Aarau (May 31 2022), we have further developed the idea to build and curate a set of R packages or R code in general as an infrastructure for federal and cantonal official statistics.
Ideally, the listed packages or scripts are publicly available, either on CRAN or on GitHub. If this is not possible, an entry should explain how one could get to the package. You may also list interesting packages that are not yet public.
ℹ️ How to list your package or script |
This R package contains data cubes published by the statistical office of Canton Ticino (Ustat). All the data cubes are data.tables in long format, with only one numerical column. These results can also be downloaded in 3 formats (csv, xlsx, px) from the Ustat website.
Used by: Statistical office of Canton Ticino (Ustat)
Shiny app to extract and reshape information from data cubes (from the Ustat site but with other data too). The package also contains shiny modules that could be used to create other shiny apps.
Used by: Statistical office of Canton Ticino (Ustat)
Read Swiss time series data from the ‘KOF Datenservice’ API, https://datenservice.kof.ethz.ch. The API provides macro economic time series data mostly about Switzerland. The package itself is a set of wrappers around the ‘KOF Datenservice’ API. The ‘kofdata’ package is able to consume public information as well as data that requires an API token.
Used by: KOF Swiss Economic Institute, SNB, several cantonal statistical offices
At Statistik Aargau, we use several {targets}-pipelines to organize, maintain and run our data analysis workflows.
Used by: Statistik Aargau (internal application).
How to access: The code has not been published online yet. Send us an email.
temporal disaggregation methods are used to disaggregate and interpolate a low frequency time series to a higher frequency series, where either the sum, the mean, the first or the last value of the resulting high frequency series is consistent with the low frequency series.
Used by: State Secretariat of Economic Affairs
Easy-to-use interface to X-13-ARIMA-SEATS, the seasonal adjustment software by the US Census Bureau.
Used by: State Secretariat of Economic Affairs
This R package specifically focuses on providing an efficient way for creating interactive heatmaps for categorical data or continuous data that can be grouped into categories.
Used by: Stadt Zürich - Verkehrsbetriebe (VBZ) and others
Admindown provides an R Markdown template in line with the corporate design of the federal government of Switzerland.
Used by: State Secretariat of Economic Affairs; others
How to access: This is a private repo, access is granted to any federal office. Just drop an email.
statR provides functions to export nicely formatted .xlsx, color palettes, a ggplot theme and a html template to create data products with the corporate design of the canton of Zurich.
Used by: Statistical Office Canton of Zurich; others
swissdd builds upon real time data service for federal and cantonal votes provided by the Federal Statistical Office via opendata.swiss. It brings the results of popular votes, aggregated at the geographical level of choice, straight into R.
Used by: Statistical Office Canton of Zurich; others
This package allows to create E-Dossiers (publication-ready Excel workbooks with tables and graphics) directly from R. The package relies heavily on the {openxlsx} package and simplifies the usage for the creation of informative workbooks for end users.
Used by: Statistik Aargau (internal application).
How to access: The package / code has not been published online yet. Send us an email.
staagAGZ provides functions for creating the “Aargauer Zahlen” in pdf format from an R Markdown document. In particular, the functions produce LaTeX code within the R Markdown document (using the LaTeX-package tabularray) for creating the tables in the desired layout.
Used by: Statistik Aargau (internal application).
How to access: The package / code has not been published online yet. Send us an email.
This package projects the population of canton Aargau at cantonal or regional level based on the demographic model of the Swiss Federal Statistical Office (FSO) released in May 2020.
Used by: Statistik Aargau (internal application).
How to access: This package is not available in a public repository. Send us an email.
This package contains the entire collection of code for the shiny app Gemeindeporträt Kanton Aargau which is published here: https://www.ag.ch/app/statistik_aargau_gemeindeportraet/. The app is based on public data published by Statistik Aargau (accessible via different APIs or the official website).
Used by: Statistik Aargau (internal application).
How to access: The package / code has not been published online yet. Send us an email.
This package contains the entire collection of code for the shiny app «Bevölkerungsprojektion Kanton Aargau» (not published yet). The webapp is based on the projected population data by Statistik Aargau (accessible via different APIs or the official website).
Used by: Statistik Aargau (internal application).
How to access: The package / code / app has not been published online yet and is still work in progress. For more Information send us an email.
This is the first out of three packages that were created to analyze the BFS “Mikrozensus Mobilität und Verkehr (MZMV) 2015” data. The analysis functions that are included in the MCMTdataanalysis package need a specific data input argument. Since the MZMV data can not be shared freely we created a function that will automatically create this data argument given a path to a folder that contains the original BFS data. This package is intended to be used as the first step to analyze the MZMV thanks to the MCMTdataanalysis package functions.
Used by: Statistical office of Canton Ticino (Ustat)
The aim of this package is to provide a set of tools to select, clean and prepare the “Mikrozensus Mobilität und Verkehr (MZMV)” raw data, to be then analyzed with the MCMTdataanalysis package functions. The MCMTdataprep functions will make use of the data object previously created with the MCMTdatalistcreation package. It will import the data, and select, clean and recode the variables needed to produce the BFS A2 table. This package is intended to be used as the second step to analyze the MZMV data. The MZMV data must be first passed through these functions to be analyzed thanks to the MCMTdataanalysis package.
Used by: Statistical office of Canton Ticino (Ustat)
This package was created with the purpose to analyze the “Mikrozensus Mobilität und Verkehr (MZMV)” based on the BFS methodology. These functions allow any user to reproduce the results as presented in the BFS table A2. The package makes use of the the distrr package, to build data cubes, and therefore to produce results in addition to those in the BFS table. This package is meant to be used after having processed the raw data with the MCMTdatalistcreation and MCMTdataprep packages. This package will be furthermore deveolped to add new features.
Used by: Statistical office of Canton Ticino (Ustat)
The goal of rpango is to allow access the SARS-CoV-2 pango nomenclature as a tree object in R. This simplifies the manipulation of linelisting containing SARS-CoV-2 information (data validation, grouping to cluster, etc).
This package was developped by the Data Science Team of the Covid-19 Taskforce of the Swiss Federal Office of Public Health with initial contributions from the Computational Evolution group of the D-BSSE of the ETH Zürich. It relies on the Tidyverse ecoystem and the tidygraph package.
Used by: Swiss Federal Office of Public Health.
How to access: This package is not available in a public repository. Send us an email to request access.