I am trying to tally and sort the number of consecutive occurrences in a list above a certain value.
For instance:
data={55.5, 65.3, 100.3, 100.1, 100.5, 98.7, 75.2, 101.3, 102.1}
The totals for this data set would be {3,2} if the tally criteria were all values greater than 100.
As I have worked on this problem, I found the following code:
a = RandomInteger[1, {100}];
Cases[Split[a], {1, ___}] // Tally // Sort
Which is very close to what I am trying to do. In this case, the code provides a sorted list of consecutive integers equal to one.
However, I can't seem to modify the decision criteria to only tally values above a certain criteria.
How might I go about this?
(Total /@ Split@(Boole[# > 100] & /@ data)) /. (0 -> Sequence[])
$\endgroup${. . . , 3, 7, 108, 2, 14, . . .}
? $\endgroup$