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

View source: R/utils.R

cut_by_tauR Documentation

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)

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

Value

  • cut_by_tau() a base::factor() of half-open intervals

  • split_by_tau() a named base::list() of numeric vectors

See Also

base::cut()

base::split()

Examples

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))


tidychangepoint documentation built on April 4, 2025, 4:31 a.m.