round Date object to 10 minutes intervals?
Dear Mr. Ripley, your answer perfectly fits my needs, thank you very much. (And yes, rounding 5 to even is what I wanted). Prof Brian Ripley wrote
t2 <- strptime(timeStamp, format="%d.%m.%Y %H:%M") t2$min <- round(t2$min, -1)
format(t2, "%d.%m.%Y %H:%M")
[1] "31.03.2011 09:30" "31.03.2011 09:40" "31.03.2011 10:00" "31.03.2011 10:10" [5] "31.03.2011 10:30" "31.03.2011 10:40" "31.03.2011 10:50" "01.04.2011 00:00"
Prof Brian Ripley wrote
t2$min <- 10*floor((t2$min + 5)/10) t2$min <- 10*floor((t2$min + 4)/10)
This really got me thinking and as a result increased my understanding of maths & R , a big thanks to you -- View this message in context: http://r.789695.n4.nabble.com/round-Date-object-to-10-minutes-intervals-tp4185496p4185776.html Sent from the R help mailing list archive at Nabble.com.