Learn R Programming

timeseriesdb (version 0.4.1)

readTimeSeries: Read Time Series From PostgreSQL database

Description

This function reads a time series from a PostgreSQL relation that uses Postgres' key value pair storage (hstore). After reading the information from the database a standard R time series object of class 'ts' is built and returned. Irregular time series return zoo objects.

Usage

readTimeSeries(series, con, valid_on = NULL, tbl = "timeseries_main",
  tbl_vintages = "timeseries_vintages", schema = "timeseries", env = NULL,
  pkg_for_irreg = "xts", chunksize = 10000, respect_release_date = FALSE,
  regex = FALSE)

Arguments

series

character vector of time series keys

con

a PostgreSQL connection object

valid_on

character date string on which the series should be valid. Defaults to NULL. Only needed when different vintages of a time series are stored.

tbl

character string denoting the name of the relation that contains ts_key, ts_data, ts_frequency.

tbl_vintages

character table name of the relation that holds time series vintages

schema

character SQL schema name. Defaults to timeseries.

env

environment, optional argument to dump time series directly into an environment. Most often used with globalenv(), which gives all time series directly back to the global env.

pkg_for_irreg

character name of package for irregular series. xts or zoo, defaults to xts.

chunksize

numeric value of threshold at which input vector should be processed in chunks. defaults to 70000.

respect_release_date

logical should the relaase set in the database be respected. If TRUE, the last observation will be cut off if server time is before release date. Reasonable for relesae date.

regex

If set to TRUE, series will be interpreted as a regular exporession, so that all time series whose keys match the pattern will be returned.