I have a set of days - each with code 0/1 - for the presence of the event I will call "visit".
For example, for the 1st day of the 12th day, I could have a vector (0,0,1,0,1,1,1,1,0,0,0,1) when I visit days 3,5 , 6, 7,8 and 12. I would like to apply some function that will give me a vector (1,4,1), which will mean 3 groups of visits lasting 1, 4 and 1 day. Easy to find 0s. I canβt understand how to combine lag and cumulative amounts to get a 1-day visit or an extended visit.
r
Georgette
source share