Learn R Programming

timeseriesdb (version 1.0.0-1.1.2)

db_ts_delete_latest_version: Delete the Latest Vintage of a Time Series

Description

Vintages of time series should not be deleted as they are versions and represent a former status of a time series that may not be stored elsewhere, even not with their original provider. To benchmark forecasts it is essential to keep the versions to evaluate real time performance of forecasts. However, when operating at current edge of a time series, i.e., its last update, mistakes may happen. Hence timeseriesdb allows to update / delete the last iteration. Do not loop recursively through iterations to delete an entire time series. There are admin level functions for that.

Usage

db_ts_delete_latest_version(con, ts_keys, schema = "timeseries")

Arguments

con

RPostgres connection object.

ts_keys

character vector of time series identifiers.

schema

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

See Also

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

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
# Store different versions of the time series data
ch.kof.barometer <- kof_ts["baro_2019m11"]
names(ch.kof.barometer) <- c("ch.kof.barometer")
db_ts_store(
  con = connection,
  ch.kof.barometer,
  valid_from = "2019-12-01",
  schema = "schema"
)

ch.kof.barometer <- kof_ts["baro_2019m12"]
names(ch.kof.barometer) <- c("ch.kof.barometer")
db_ts_store(
  con = connection,
  ch.kof.barometer,
  valid_from = "2020-01-01",
  schema = "schema"
)

db_ts_delete_latest_version(
  con = connection,
  ts_keys = "ch.kof.barometer",
  schema = "schema"
)
# }

Run the code above in your browser using DataLab