In R say I had the dataframe:
frame object positive
1 6 0
2 6 1
3 6 1
4 6 1
5 6 1
6 6 0
7 6 0
8 6 1
9 6 1
10 6 1
1 7 1
2 7 1
3 7 1
4 7 1
5 7 1
6 7 0
7 7 1
8 7 0
9 7 1
10 7 1
I am trying to create a new table which counts the consecutive occurrences of the value of 1 in the positive column for each separate object and outputs the maximum and mean consecutive occurrences. Which would look like :
object max mean
6 4 3.5
7 5 8/3
Thank you for your help!