I am trying to give an ID to each event, like on the picture 1 but I struggle to tell R "if the previous cell in start_f is a 0, then I want the same ID as the previous cell" (the column start_f looks like picture 2
I tried to use the function lag() in a ifelse function but it did not work.
I am not sure on how to refer to the previous cell in that case. Do you have any idea?
Aucun commentaire:
Enregistrer un commentaire