Skip to contents

Concatenates the tail of the previous time series (`prev`) with the current one (`curr`), keeping only the last `n_former` points from `prev`. If `prev` is `NA`, returns `curr` unchanged.

Usage

concat_ts(prev = NA, curr, n_former)

Arguments

prev

A `ts` object or `NA` (default). Previous time series.

curr

A `ts` object. Current time series.

n_former

An integer. Number of tail points from `prev` to keep.

Value

A new concatenated `ts` object.

Examples

if (FALSE) { # \dontrun{
prev <- ts(1:100, start = 0, frequency = 1)
curr <- ts(101:105, start = 100, frequency = 1)
concat_ts(prev, curr, n_former = 5)
} # }