knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(kofdata)
Data collections are a set of KOF time series identifiers (key) that allow you consume a previously defined selection of time series -- very much comparable to a playlist on your favorite music streaming service. The collections does not contain the actual data, but their identifiers. Collections make it easy to consume the same series on a regular basis like, e.g., in a economic monitoring setup.
Note that at the time of writing this the API does not allow users to define custom collections. Still, collections are useful to group time series and refer to one single collection name to consume a (large) number of time series as opposed to make single collections and listing all keys every time we consume the data.
kof_collections <- list_available_collections() head(kof_collections)
Listing available collections is straight forward just like consuming time series within a collection.
The get_collection
command returns a list of time series in this case the Open Government Data (OGD) composition of the Economic Sentiment Indicator which consists of two time series, the current ESI and a 2018 version of the indicator:
esi <- get_collection("ogd_ch.kof.esi") # tstools is good a conveniently plotting list of time series.. tstools::tsplot(esi)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.