Identify start and end time of a value per id in a data frame
问题 This relates to my previous question on identifying the occurrence of a value in a data frame per id. This time I am trying to identify consecutive measurements per id with a length of 4 or more. Ex. Below an example of the consecutive occurrence of w with the length of 4 id t1 t2 t3 t4 t5 t6 1 s s w w w w For the same id an example of the consecutive occurrence of w with the length of 4 as well 4 non-w occurrences after the last w id t3 t4 t5 t6 t7 t8 t9 t10 1 w w w w r s s s I would like to