Compute consecutive run lengths for flatline detection
Source:R/utilASRflagrleflat.R
utilASRflagrleflat.RdCompute consecutive run lengths for flatline detection
Details
For each position \(i\), the run length is the number of
consecutive observations ending at \(i\) (including \(i\) itself)
for which each successive absolute difference is \(\le\) delta.
A run length of 1 means the observation is not part of a flat stretch.
NA values in vals break the run.
Examples
vals <- c(10, 10, 10.005, 10.003, 12, 12, 12)
utilASRflagrleflat(vals, delta = 0.01)
#> [1] 1 2 3 4 1 2 3