I have a R dataframe like this:
ID      Event Out  
A         0    0
A         1    1
A         1    1
A         0    0
A         1    2
B         1    3
B         0    0
C         1    4
C         1    4
C         1    4
I am trying to create the out field which is a sequential conditional (on event =1 or not) repeated index. The index needs to increment by 1 with every new group occurrence of the event but carrying on in the sequence from the previous group. Is there a plyr option for this. Thanks in advance.
 
     
     
    