Learn R Programming

tidychangepoint (version 1.0.1)

cut_by_tau: Use a changepoint set to break a time series into regions

Description

Use a changepoint set to break a time series into regions

Usage

cut_by_tau(x, tau)

split_by_tau(x, tau)

Value

Arguments

x

A numeric vector

tau

a numeric vector of changepoint indices

Details

A changepoint set tau of length \(k\) breaks a time series of length \(n\) into \(k+1\) non-empty regions. These non-empty regions can be defined by half-open intervals, starting with 1 and ending with \(n+1\).

cut_by_tau() splits a set of indices into a base::factor() of half-open intervals

split_by_tau() splits a time series into a named base::list() of numeric vectors

See Also

Examples

Run this code
n <- length(CET)

# Return a factor of intervals
cut_by_tau(1:n, tau = pad_tau(c(42, 81, 330), n))

# Return a list of observations
split_by_tau(DataCPSim, c(365, 826))

Run the code above in your browser using DataLab