How is this achieved using times directly? A more elegant solution would be much appreciated
times <- c(paste(9, 5*(0:11), sep = ":"),paste(10, 5*(0:11), sep = ":"))
times_as_hm <- lubridate::hm(times)
How is this achieved using times directly? A more elegant solution would be much appreciated
times <- c(paste(9, 5*(0:11), sep = ":"),paste(10, 5*(0:11), sep = ":"))
times_as_hm <- lubridate::hm(times)
We may do this as
library(lubridate)
times_as_hm2 <- hm("9:0")+ seconds_to_period(5 *(0:23) * 60)
-testing
> all.equal(times_as_hm, times_as_hm2)