powered by
Find zero crossings of a vector, i.e., indices when the numeric variable crosses 0.
zero_crossings(x)
Vector of zero crossings.
A numeric vector.
Based on the uniroot.all function from the rootSolve package.
uniroot.all
x <- sin(seq(0, 4 * pi, length.out = 100)) plot(x) zero_crossings(x)
Run the code above in your browser using DataLab