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.

{timeseriesdb}: A Time Series Database for Official Statistics

CRAN_Status_Badge CRAN_time_from_release metacran downloads license

-> GitHub Pages Documentation Site <-

{timeseriesdb} maps R time series objects to PostgreSQL database relations for permanent storage. Instead of writing time series to spreadsheet files or .RData files on disk, {timeseriesdb} uses a set of PostgreSQL relations which allows to store data alongside extensive, multi-lingual meta information in context aware fashion. {timeseriesdb} was designed with official statistics in mind: It can keep track of various versions of the same time series to handle data revisions, e.g., in the case of GDP data.

Why {timeseriesdb} ?

{timeseriesdb} …

What Does {timeseriesdb} NOT DO ?

{timeseriesdb} is not built to incrementally append new observations as fast as possible. {timeseriesdb} does not try to compete with the amazing speed of InfluxDB. It’s not a server log or IoT minded time series storage.

Quick Start Guide

Make sure you followed the installation notes to make sure all components of the {timeseriesdb} were installed properly: PostgreSQL, necessary PostgreSQL extension, R as well as the {timeseriesdb} R package.

Example Use (Basic Usage)

The following examples illustrate basic use in a nutshell. The learn more about the use of {timeseriesdb}, read the vignette articles.

Store a List of R Time Series Objects to the Database

# Create DB connection. 
# In this case connect to a local db running on port 1111
# /w lame passwords -- strongly discouraged for production. 
con <- dbConnect(Postgres(),
                "dev_writer", "localhost",
                 1111, "dev_writer",
                "postgres")
tsl <- list(ts1 = ts(rnorm(100), frequency = 12,
                     start = 2002),
            ts2 = ts(rnorm(100), frequency = 12,
                     start = 2001))
db_store_ts(connection, tsl)
dbDisconnect(con)

Read Data into a list of R time Series object

con <- dbConnect(Postgres(),
                "dev_writer", "localhost",
                 1111, "dev_writer",
                "postgres")

tsl <- db_read_ts(connection, c("some_ts_id","another_ts_id"))
dbDisconnect(con)

Advanced Features

{timeseriesdb} offers a plethora of features beyond just mere storage of time series themselves:

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.