The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

dataseries: Switzerland’s Data Series in One Place

R-CMD-check Codecov test coverage CRAN status

Download and import open Swiss economic time series from dataseries.org, a comprehensive and up-to-date collection of public data from Switzerland. The package talks to the public dataseries.org API and imports series as a data.frame or ts object.

Installation

install.packages("dataseries")

Or the development version from GitHub:

# install.packages("remotes")
remotes::install_github("cynkra/dataseries")

A Python package with the same interface is available: pip install dataseries.

Data model

Data on dataseries.org is organized into datasets. A dataset is a family of related series and, in most cases, a multi-dimensional cube — a single time series is one cell of that cube, addressed by the dataset plus one code per dimension. For example the GDP dataset (ch_seco_gdp) splits along three dimensions: type (nominal/real/…), structure (GDP, value added, …) and seas_adj (seasonally adjusted or not).

Usage

library(dataseries)

# Browse what's available
ds_catalog()

# Find a specific series across all datasets
ds_search("unemployment")

# A dataset's dimensions and codes
ds_meta("ch_seco_gdp")

# Whole dataset (long data.frame)
ds("ch_fso_cpi")

# One series: pass dimension codes as named arguments
ds("ch_fso_cpi", item = "100_100")

# Several series, restricted to a date range
ds("ch_fso_cpi", item = c("100_100", "100_1"), from = "2020-01-01")

# One cell of a multi-dimensional cube, as a ts object
ds("ch_seco_gdp", type = "real", structure = "gdp", seas_adj = "csa",
   class = "ts")

All series on dataseries.org are regular (annual, quarterly or monthly), so ts covers them. If you prefer xts, convert the ts in one line: xts::as.xts(ds("ch_fso_cpi", item = "100_100", class = "ts")).

Dimension arguments are optional: omit them and you get the whole dataset. Filtering happens on the server, so selecting one series does not download the whole cube. Downloads are cached in memory for the session; cache_rm() forces a fresh download.

Labels in German, French or Italian

The catalog and search index are translated. Pass lang to get titles and labels in any Swiss national language (English is used where a translation is missing):

ds_catalog(lang = "de")
ds_search("arbeitslosen", lang = "de")

Searching matches the labels in the chosen language, so you can look for German terms directly.

Beyond R

In Python, use the dataseries package, which mirrors this interface and returns pandas DataFrames.

Every series is also available as a plain CSV from any tool that can read a URL:

https://api.dataseries.org/series.csv?dataset=ch_fso_cpi&dims=item=100_100

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.