I think that a command like the following, would return a list of the values that fall into 3 minute intervals. (v
is the name of the dataframe and datecol
is the name of the date column)
library(plyr)
v<-data.frame(datecol=as.POSIXct(c(
"2010-01-13 03:02:38 UTC",
"2010-01-13 03:03:14 UTC",
"2010-01-13 03:05:52 UTC",
"2010-01-13 03:07:42 UTC",
"2010-01-13 03:09:38 UTC",
"2010-01-13 03:10:14 UTC",
"2010-01-13 03:12:52 UTC",
"2010-01-13 03:13:42 UTC",
"2010-01-13 03:15:42 UTC",
"2010-01-13 03:16:38 UTC",
"2010-01-13 03:18:14 UTC",
"2010-01-13 03:21:52 UTC",
"2010-01-13 03:22:42 UTC",
"2010-01-13 03:24:19 UTC",
"2010-01-13 03:25:19 UTC"
)), x = cumsum(runif(15)*10),y=cumsum(runif(15)*20))
dlply(v,.(cut(datecol,"3 min")),"[")
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…