Hi everyone,
R noob here. I have a quick question: I have a huuuuuge dataset (30000 entries or so) of speeds (it's about ships) and dates/times at which these were recorded. Looks like this:
Speed Date Time
0 20191225 195752
5 20191225 185828
0 20191225 175816
0 20191225 165834
0 20191225 155852
0 20191225 145749
0 20191225 135733
5 20191225 125738
10 20191225 115808
... etc
What I'm trying to do is to identify when a ship has been immobile (speed=0) for more than 3 consecutive hours, and then remove this data. My thought process was: merge the date and time into a single column ymd_hms style. Then, create a column 'time difference between the previous and next column'... and then somehow let R identify when speed has been equal to zero over more than 3 consecutive hours, and then remove those (but even just identifying them would already be a big step forward).
So I found out how to convert date and time into a single 'datetime' column, which is nice. But now I'm completely at a loss as to what to do next, and seeing as this is a very specific example I'm struggling to find similar topic online.
I would be extremely grateful if someone could just point out some useful functions that could help me solve my problem?
Thanks in advance!!