R/getNextGap.R

Defines functions getNextGap

getNextGap = function(data, currentIndex, minIndex, maxIndex, direction) {
  nextGap = 0
  pointer = currentIndex
  while (pointer > minIndex && pointer < maxIndex) { # TURE
    pointer = pointer + direction
    nextGap = abs(data[pointer] - data[currentIndex])
    if (nextGap > 0) { # Ignores duplicates in data
      return(pointer)
    }
  }
  return(pointer)
}

Try the ScatterDensity package in your browser

Any scripts or data that you put into this service are public.

ScatterDensity documentation built on April 15, 2025, 5:09 p.m.