Learn R Programming

modelbased (version 0.8.9)

zero_crossings: Find zero crossings of a vector

Description

Find zero crossings of a vector, i.e., indices when the numeric variable crosses 0.

Usage

zero_crossings(x)

Value

Vector of zero crossings.

Arguments

x

A numeric vector.

See Also

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

Examples

Run this code
x <- sin(seq(0, 4 * pi, length.out = 100))
plot(x)
zero_crossings(x)

Run the code above in your browser using DataLab