zero_crossings: Find zero-crossings and inversion points

View source: R/zero_crossings.R

zero_crossingsR Documentation

Find zero-crossings and inversion points

Description

Find zero crossings of a vector, i.e., indices when the numeric variable crosses 0. It is useful for finding the points where a function changes by looking at the zero crossings of its derivative.

Usage

zero_crossings(x)

find_inversions(x)

Arguments

x

A numeric vector.

Value

Vector of zero crossings or points of inversion.

See Also

Based on the uniroot.all function from the rootSolve package.

Examples

x <- sin(seq(0, 4 * pi, length.out = 100))
# plot(x, type = "b")

modelbased::zero_crossings(x)
modelbased::find_inversions(x)

modelbased documentation built on April 12, 2025, 2:22 a.m.