I have a set of data that looks like this:
Date boolean
407 2006-06-01 1
408 2006-06-02 1
409 2006-06-03 1
410 2006-06-04 NA
411 2006-06-05 0
412 2006-06-06 1
413 2006-06-07 1
414 2006-06-08 0
415 2006-06-09 1
From this, I am trying to create a new data frame that will show me what dates my runs of 1's occur as well as how long these runs are, with the column headers: 1) start date, 2) end date, and 3) length of run.
Ultimately, I want to create a data frame that looks like this from the data I have above:
Start Date End Date Length of Run
1 2006-06-01 2006-06-03 3
2 2006-06-06 2006-06-07 2
I have a few NA's in my data that I need to ignore throughout my data as well.