Time is in the format of integer, and it is without date. I tried to use package lubridate but it asks for both date and time.
I was not able to find an equivalent of seq() in package chron either.
The column looks like:
time
525
1526
756
2252
...
525 represents 5:25; 1526 represents 7:56.
And I'd like to have a table that counts frequency in each 15 mins interval; intervals are 00:00-00:15, 00:16-00:30, 00:31-00:45, 00:46-00:59, ..., 23:46-23:59
We can convert to ITime
with as.ITime
from data.table
library(data.table)
v2 <- as.ITime(sub("^(..)", "\\1:", sprintf('%04d:00', df1$time)))
table(cut(v2, breaks = 15))
df1 <- structure(list(time = c(525, 1526, 756, 2252)), class = "data.frame", row.names = c(NA,
-4L))