0

I currently have a dataframe which includes a running timeline of POSIXct (see below).

Basically given a starting time of my choosing I want to be able to take rows at specific time interval. E.g. Say I start taking rows at four pm I then want to take 9 minutes, then not take anything for the next two, then nine again. I'm guessing the best approach is possibly using indexing but I also thought something like the lubridae package could be used but not sure how to exactly do it.

Thanks!

enter image description here

Dasr
  • 777
  • 6
  • 16
  • The normal comparison operators `<` etc do work with times and dates. It is fine, for example, to test `x > "2017-10-25 16:00:00" & x < "2017-10-25 16:09:00"` – JDL Dec 04 '17 at 11:02
  • Thanks JDL. I was aware that operators can be used with posixct but how would that be extended to take intervals from the df? thanks. – Dasr Dec 04 '17 at 12:12
  • You might use `difftime` to get the time from the start in minutes, and then see if that `%% 11` was less than nine, to use your example of selecting alternately on for nine minutes then off for two. – JDL Dec 04 '17 at 22:09

0 Answers0