Skip to contents

Returns the indices for consecutive elements of a vector that are greater than a specified threshold

Usage

find_consecutive_threshold(x, threshold = 0)

# S3 method for Histogram
find_consecutive_threshold(x, threshold = 0)

# S3 method for numeric
find_consecutive_threshold(x, threshold = 0)

Arguments

x

A numeric vector or Histogram object

threshold

numeric threshold

Value

list of coordinates with start and end coordinates

Examples

find_consecutive_threshold(c(0,0,0,1,1,1,0,0,0,1,1,1,0,0))
#> $start
#> [1]  4 10
#> 
#> $end
#> [1]  6 12
#> 
find_consecutive_threshold(c(0,0,1,2,2,0,1,1,1,0,0), threshold = 1)
#> $start
#> [1] 4
#> 
#> $end
#> [1] 5
#>