changepoints: Extract changepoints

View source: R/aaa_generics.R

changepointsR Documentation

Extract changepoints

Description

Retrieve the indices of the changepoints identified by an algorithm or model.

Usage

changepoints(x, ...)

## Default S3 method:
changepoints(x, ...)

## S3 method for class 'mod_cpt'
changepoints(x, ...)

## S3 method for class 'seg_basket'
changepoints(x, ...)

## S3 method for class 'seg_cpt'
changepoints(x, ...)

## S3 method for class 'tidycpt'
changepoints(x, use_labels = FALSE, ...)

## S3 method for class 'ga'
changepoints(x, ...)

## S3 method for class 'cpt'
changepoints(x, ...)

## S3 method for class 'wbs'
changepoints(x, ...)

Arguments

x

A tidycpt, segmenter, or mod_cpt object

...

arguments passed to methods

use_labels

return the time labels for the changepoints instead of the indices.

Details

tidycpt objects, as well as their segmenter and model components, implement changepoints() methods.

Note that this function is not to be confused with wbs::changepoints(), which returns different information.

For the default method, changepoints() will attempt to return the cpt_true attribute, which is set by test_set().

Value

a numeric vector of changepoint indices, or, if use_labels is TRUE, a character of time labels.

See Also

wbs::changepoints()

Other tidycpt-generics: as.model(), as.segmenter(), diagnose(), fitness(), model_name()

Examples

cpts <- segment(DataCPSim, method = "ga", maxiter = 5)
changepoints(cpts$segmenter)

cpts <- segment(DataCPSim, method = "wbs")
changepoints(cpts$segmenter)


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