我已经使用库lubridate
来查找开始时间和结束时间之间的时差。这是我的代码:
library(lubridate)
a <- read.csv("C:/Users/Desktop/Dump.csv")
b <- a$StartTime
c <- a$EndTime
hm(c)- hm(b)
这是代码的结果:
[1] "1H -18M 0S" "1H 5M 0S" "1H 16M 0S" "1H 16M 0S" "1H 5M 0S" "1H 16M 0S" "1H 18M 0S"
[8] "44M 0S" "1H 0M 0S" "1H 23M 0S" "2H -41M 0S" "1H -18M 0S" "1H -18M 0S" "1H -16M 0S"
[15] "1H 0M 0S" "41M 0S" "1H 0M 0S" "24M 0S" "1H -20M 0S" "1H 0M 0S" "1H -19M 0S"
[22] "1H 16M 0S" "1H 25M 0S" "1H 10M 0S" "1H 16M 0S" "44M 0S" "1H 18M 0S" "1H 23M 0S"
[29] "1H -19M 0S" "1H 6M 0S" "1H 16M 0S" "1H -19M 0S" "1H -17M 0S" "1H -20M 0S" "1H 0M 0S"
[36] "2H -40M 0S" "2H -40M 0S" "1H -20M 0S" "1H -20M 0S" "1H 5M 0S" "1H 17M 0S" "1H 11M 0S"
[43] "1H -23M 0S" "1H -30M 0S" "1H -29M 0S" "1H -19M 0S" "45M 0S" "1H -19M 0S" "1H 1M 0S"
[50] "1H -6M 0S" "30M 0S" "1H 28M 0S" "1H -21M 0S" "30M 0S" "1H 1M 0S" "1H -10M 0S"
[57] "1H 0M 0S" "1H -28M 0S" "42M 0S" "51M 0S" "52M 0S" "1H 17M 0S" "2H -43M 0S"
[64] "1H -19M 0S" "1H 1M 0S" "1H -26M 0S" "50M 0S" "1H -19M 0S" "1H 0M 0S" "1H -23M 0S"
[71] "1H 2M 0S" "40M 0S" "30M 0S" "1H -15M 0S" "1H -6M 0S" "30M 0S" "1H -33M 0S"
[78] "1H -20M 0S" "1H 4M 0S" "41M 0S" "1H 13M 0S" "1H 0M 0S" "1H 0M 0S" "1H -30M 0S"
[85] "29M 0S" "1H 10M 0S" "1H 5M 0S" "1H 0M 0S" "1H -27M 0S" "51M 0S" "1H -5M 0S"
[92] "31M 0S" "1H -30M 0S" "33M 0S" "1H 0M 0S" "36M 0S" "2H -43M 0S" "1H -30M 0S"
[99] "34M 0S" "50M 0S" "1H -31M 0S" "41M 0S" "50M 0S" "1H -15M 0S" "1H -15M 0S"
这是我的结果,但分钟数为负,这意味着正确的答案是“小时-分钟”。任何人都知道我的代码在哪里是错误的,或者我忘记编写任何代码。
数据的格式是因子。
答案 0 :(得分:0)
您可能拥有信号时间数据库(给出的代码不会重现这种结果)。但是,请尝试计算经过的时间(time2-time3或time2%-%time3)和使用时间,以正确的格式
pip install --only-binary :all: mysqlclient