I want to calculate a time-based sliding window in R.
My data frame has the columnames: id
, rec_time
, pupil_x
, pupil_y
.
I want to calculate descriptive statistics for each window. The window size should be 30 seconds, the step size 15 seconds.
I am aware of the function rollapply
of the package zoo
.
But I don´t know how to use the function to create sliding windows by timestamp.
Looking forward to your answer. Thanks!