helper function to convert start indices to end indices
startsToEnds(starts, lastStop, stopOffset = 1)
starts | vector of integer |
---|---|
lastStop | number to be returned as last element of the result vector |
stopOffset | number to be subtracted from (all but the first elements in) starts in order to find the ends |
vector of integer
starts <- c(1, 10, 20, 35) ok <- identical( startsToEnds(starts, lastStop = 50), c(9, 19, 34, 50) ) ok <- ok && identical( startsToEnds(starts, lastStop = 50, stopOffset = 2), c(8, 18, 33, 50) ) ok#> [1] TRUE