I am looking to count the number of times the value is below a point and when it exceeds the threshold to start counting from start.
For example if I have
X <- c(1,2,11,14,5,6,7,12)
and I am counting the number of times the values are less than 10 consecutively then I want an answer as
Output = 2,3 Since 1,2 are less than 10 so total 2 and then the count starts again for 5,6,7 and the total is 3