Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
时间为整数格式,不带日期。我尝试使用包 lubridate,但它要求提供日期和时间。
我也无法在包 chron 中找到等效的 seq() 。
该列如下所示:
time 525 1526 756 2252 ...
525 代表 5:25;1526 代表 7:56。而且我想要一个表格来计算每 15 分钟间隔的频率;间隔是00:00-00:15, 00:16-00:30, 00:31-00:45, 00:46-00:59, ..., 23:46-23:59
00:00-00:15, 00:16-00:30, 00:31-00:45, 00:46-00:59, ..., 23:46-23:59
我们可以转换为ITimewith as.ITimefromdata.table
ITime
as.ITime
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))