I'm assuming by your last line that you are trying to avoid using packages.
Sticking with base R, you can try tapply
, but your dates will become the rownames
(or names
, if you skip the data.frame
step):
data.frame(value = tapply(cbind(dt$value),
list(cut(dt$date, breaks="10 min")),
sum))
# value
# 2011-08-08 21:00:00 1
# 2011-08-08 21:10:00 NA
# 2011-08-08 21:20:00 2