Is there a way to store time data in R in a class that only handles time (without dates)? I don\'t need to include dates and I feel it will take up extra memory and visualiz
As my previous comment, here an example of period
class from the lubridate
package, which I think it might be useful for you. For more information just ?Period-class
.
library(lubridate)
t1 <- hm("10:38")
t1
[1] "10H 38M 0S"
t2 <- hm("10:39")
t1 - t2
[1] "-1M 0S"
Package data.table
has a new class ITime which solves this problem ideally.
library(data.table)
> as.ITime("12:00")-as.ITime("11:10:01")
[1] "00:49:59"