cpt_labels: Changepoint labels

View source: R/supervised.R

cpt_labelsR Documentation

Changepoint labels

Description

Builds the tidy label set that the supervised functions consume: one row per labelled region, each asserting how many changepoints that stretch of the series contains.

Usage

cpt_labels(start, end, change = "change", series = NA_character_)

## S3 method for class 'cpt_labels'
tidy(x, ...)

Arguments

start, end

Integer vectors of region boundaries (positions, inclusive).

change

What the region asserts, recycled to length:

"change"

at least one changepoint lies in the region.

"one_change"

exactly one does: a stricter label, and the one that makes false positives detectable inside a positive region.

"no_change"

none does.

series

Optional series identifier, for label sets spanning a panel.

x

A cpt_labels tibble (for tidy(), which returns it as a plain tibble).

...

Ignored.

Value

A cpt_labels tibble with columns label_id, series, start, end, change.

References

\insertRef

hocking2013penaltiesggchangepoint

See Also

cpt_label_error(), geom_cpt_label(), cpt_learn_penalty(), as_cpt_labels() to convert a plain changepoint set.

Examples

cpt_labels(c(40, 70), c(60, 90), c("change", "no_change"))

ggchangepoint documentation built on Nov. 5, 2026, 9:06 a.m.