I struggle with dates and times in R, but I am hoping this is a fairly basic task.
Here is my dataset:
> str(temp.df)
\'data.frame\': 74602 obs.
Use the proper time series packages zoo and/or xts. This example is straight from the help pages of aggregate.zoo()
which aggregates POSIXct seconds data every 10 minutes
tt <- seq(10, 2000, 10)
x <- zoo(tt, structure(tt, class = c("POSIXt", "POSIXct")))
aggregate(x, time(x) - as.numeric(time(x)) %% 600, mean)
The to.period()
function in xts is also a sure winner. There are countless examples here on SO and on the r-sig-finance list.