I would like to know if a list has repeated consecutive values above a threshold. Lets say for this example the threshold is 5.
list={0, 0, 1, 2, 3, 3, 4, 2, 1, 2, 0, 2, 6, 7, 6, 5, 4, 3, 3, 4, 6, 2, 7, 6, 5, 3, 5, 4, 5, 2, 2, 1, 2, 4, 3, 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 4, 3, 0, 1, 2}
because of the run 6, 7, 6,
and 7, 6,
the function should return True
or 1
or some indication that consecutive values in the list are above the threshold.
If the threshold is 6 the function would yield False
or 0
as there are no consecutive values above 6.
This code fails
Select[Split[list], First[#] > 5 && Length[#] > 1 &, Infinity]
The Split only works for consecutive values of the same value where I need it to split for consecutive values above a threshold.
I tried SplitBy but my pattern is incorrect.
SplitBy[list, Repeated[#] > 5 &]
I understand that neither of these functions above will give True
or 1
but once the pattern is correct, taking it to the True
or 1
is easy.