Find zero crossings of a vector, i.e., indices when the numeric variable crosses 0.
A numeric vector.
Vector of zero crossings.
Based on the
uniroot.all function from the rootSolve package.
x <- sin(seq(0, 4 * pi, length.out = 100)) plot(x) zero_crossings(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.