我正在尝试减去 2 个包含以下格式的日期时间信息的字符向量:
> dput(train2)
structure(list(time2 = c("2011-09-01 23:44:52.533", "2011-09-05 12:25:37.42",
"2011-08-24 12:56:58.91", "2011-10-25 07:18:14.722", "2011-10-25 07:19:51.697"
), time3 = c("2011-09-01 23:43:59.752", "2011-09-05 12:25:01.187",
"2011-08-24 12:55:13.012", "2011-10-25 07:16:51.759", "2011-10-25 07:16:51.759"
)), .Names = c("time2", "time3"), row.names = c(NA, 5L), class = "data.frame")
我四处寻找并使用zoo
, as.Date
,as.POSIXct
等来尝试找到正确的代码来减去 2 个日期时间对象并在几秒钟内得到答案,但没有运气。
我会很感激任何建议。