R/find_intersection.R

Defines functions find_intersection

find_intersection = function( Y, threshold=0 ) {
    # find first to cross a threshold
    good = which(is.finite(Y))
    ngood = length(good)
    X = 1:ngood
    i = 1
    for (i in 1:ngood) {
      if ( Y[good[i]] > threshold ) next()
    }
    if (i > ngood) i = ngood
    index = good[i]
    return(index)
}
jae0/emei documentation built on Jan. 25, 2024, 10:57 p.m.