KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a vector of hours. For example: vec.hours <- c("15:52:00", "15:56:00", "12:10:00", "15:12:00", "11:49:00" ,"13:35:00", "14:53:00") I would like to round the hours to get the new hours that will be the nearest whole 5 minutes, like this. round.hours <- c("15:50:00", "16:00:00", "12:10:00", "15:10:00", "11:50:00" ,"13:35:00", "14:55:00" ) I tried this hour <- strptime(vec.hours , "%H:%M:%S") round.hour <- round(hour , "mins") But it isn't working. After for each round.hours I want to do +/- one hour, for example like this: hour.rd <- strptime(round.hours[1] , "%H:%M:%S") hourM <- hour.rd - 3600 hourP <- hour.rd + 3600 l.tm <- timeSequence(from = hourM, to = hourP,format = "%H-%S-%M",by="5 min",FinCenter = "Europe/Zurich") so, for 15:50:00 I have a vector of times from 14:50 until 16:50. I dont know how to get round.hour from vec.hours. Many thanks
Tags (comma-separated)
Save Edits
Cancel