db_ts_read: Read Time Series From PostgreSQL into R

View source: R/read_time_series.R

db_ts_readR Documentation

Read Time Series From PostgreSQL into R

Description

Read specific version of a time series given time series key (unique identifier) and validity. By default, this function returns the most recent version of a time series.

Usage

db_ts_read(
  con,
  ts_keys,
  valid_on = NULL,
  regex = FALSE,
  respect_release_date = FALSE,
  schema = "timeseries",
  chunksize = 10000
)

Arguments

con

RPostgres connection object.

ts_keys

character vector of time series identifiers.

valid_on

character representation of a date in the form of 'YYYY-MM-DD'. valid_on selects the version of a time series that is valid at the specified time.

regex

boolean indicating if ts_keys should be interpreted as a regular expression pattern. Defaults to FALSE.

respect_release_date

boolean indicating if it should the release embargo of a time series be respected. Defaults to FALSE. This option makes sense when the function is used in an API. In that sense, users do not have direct access to this function and therefore cannot simply switch parameters.

schema

character name of the database schema. Defaults to 'timeseries'

chunksize

set a limit of the number of time series requested in the function.

Value

list of time series. List elements vary depending on nature of time series, i.e., regular vs. irregular time series.

See Also

Other time series functions: db_collection_read_ts(), db_dataset_read_ts(), db_ts_delete_latest_version(), db_ts_delete(), db_ts_get_last_update(), db_ts_read_history(), db_ts_store(), db_ts_trim_history()

Examples


## Not run: 
db_ts_store(con = connection, zrh_airport, schema = "schema")
db_ts_read(con = connection, ts_keys = "ch.zrh_airport.departure.total", schema = "schema")

## End(Not run)

timeseriesdb documentation built on March 24, 2022, 1:06 a.m.