如何在R中将数字转换为时间(hh:mm)?

时间:2014-11-21 07:04:26

标签: r time type-conversion

我有一系列从1到288的数字,我想转换1到11:00,2到11:05,3到11:10,等等。我该怎么做?

1 个答案:

答案 0 :(得分:9)

假设time是指POSIXct对象:

start <- as.POSIXct(x = "11:00", format = "%H:%M")
seq(from = start, by = "5 mins", length.out = 288)