First time poster, I hope I do this the correct way...
Okay, so I have a dataframe that looks like this
Stationary | |||||
---|---|---|---|---|---|
Heartrate | Datetime | Behaviour | Dog | Visitor | Variable |
104 | 2018-10-16 10:19:33 | NA | NA | NA | Stationary |
104 | 2018-10-16 10:19:34 | NA | NA | NA | Stationary |
104 | 2018-10-16 10:19:35 | NA | NA | NA | Stationary |
As you can see, my Datetime is in seconds, and each row equals one second of Stationary behaviour.
My goal here is to write a code that makes Rstudio exclude each segment lasting less than 120 seconds. So, if the Datetime jumps from 2018-10-16 10:19:33 to 2018-10-16 10:22:45, these will be recognized as seperate events, and the continuous time will be registrated. All segments less than 120 seconds long (120 rows with continuous time) should be excluded from the rest of my analysis in order to establish a mean heart rate.
I'm very new to Rstudio, and have not yet found a code that helps me do this, perhaps because I'm not really sure what I'm looking for. Any pointers would be awesome!