db_ts_trim_history: Remove Vintages from the Beginning

View source: R/delete_time_series.R

db_ts_trim_historyR Documentation

Remove Vintages from the Beginning

Description

Removes any vintages of the given time series that are older than a specified date.

Usage

db_ts_trim_history(con, ts_keys, older_than, schema = "timeseries")

Arguments

con

RPostgres connection object.

ts_keys

character vector of time series identifiers.

older_than

Date cut off point

schema

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

Details

In some cases only the last few versions of time series are of interest. This function can be used to trim off old vintages that are no longer relevant.

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_read(), db_ts_store()

Examples


## 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_trim_history(
  con = connection,
  ts_keys = "ch.kof.barometer",
  older_than = "2019-12-31",
  schema = "schema"
)

## End(Not run)

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