Learn R Programming

tidychangepoint (version 1.0.0)

changepoints: Extract changepoints

Description

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

Usage

changepoints(x, ...)

# S3 method for default changepoints(x, ...)

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

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

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

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

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

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

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

Value

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

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

See Also

wbs::changepoints()

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

Examples

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

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

Run the code above in your browser using DataLab