Excluding segments of time that last less than x

Hi, and welcome!

Please see the FAQ: What's a reproducible example (`reprex`) and how do I do one? Using a reprex, complete with representative data will attract quicker and more answers.

Date arithmetic in combination with data frames can be tricky. What I'd outline, for lack of a reprex is using dplyr::mutate(cumulative_interval = FUNCTION) to create a new variable to keep a running tally of cumulative time, then we'd figure out how to delete the rows back to the last row with a cumulative time less than 30 from rows with cumulative times that end greater than 30. It will be tricky, but the first step is to look at the duration() function in the lubridate package to get familiar with one way to handle date arithmetic.

2 Likes