转换时间数据时不想要的NA

时间:2019-03-30 18:18:33

标签: r data.table lubridate

我正在使用此数据集:

> head(datanet)
   Date & Time [Local]  Latitude Longitude
1:    06/12/2018 00:00 -2.431071  34.85492
2:    06/12/2018 00:04 -2.430954  34.85469
3:    06/12/2018 00:08 -2.430890  34.85463
4:    06/12/2018 00:12 -2.430927  34.85461
5:    06/12/2018 00:16 -2.430927  34.85461
6:    06/12/2018 00:20 -2.430909  34.85461

我正在将以下代码应用于它:

> datanet1<-datanet[, DateTime := dmy_hm(`Date & Time [Local]`)]
Warning message:
 12954 failed to parse. 
> head(datanet1)
   Date & Time [Local]  Latitude Longitude            DateTime
1:    06/12/2018 00:00 -2.431071  34.85492 2018-12-06 00:00:00
2:    06/12/2018 00:04 -2.430954  34.85469 2018-12-06 00:04:00
3:    06/12/2018 00:08 -2.430890  34.85463 2018-12-06 00:08:00
4:    06/12/2018 00:12 -2.430927  34.85461 2018-12-06 00:12:00
5:    06/12/2018 00:16 -2.430927  34.85461 2018-12-06 00:16:00
6:    06/12/2018 00:20 -2.430909  34.85461 2018-12-06 00:20:00

当我查看输出的表datanet1时,我发现NA中的某些DateTime中有一些行,但没有其他行。见下文:

> head(datanet1[358:365,])
   Date & Time [Local]  Latitude Longitude            DateTime
1:    06/12/2018 23:48 -2.427663  34.84890 2018-12-06 23:48:00
2:    06/12/2018 23:52 -2.427672  34.84888 2018-12-06 23:52:00
3:    06/12/2018 23:56 -2.427674  34.84888 2018-12-06 23:56:00
4:    06/13/2018 00:00 -2.427672  34.84889                <NA>
5:    06/13/2018 00:04 -2.427573  34.84887                <NA>
6:    06/13/2018 00:08 -2.427573  34.84887                <NA>

可能是什么问题?我已经将此代码用于其他数据集,并且效果很好。我将在下面上传一个dput()示例:

> dput(datanet[1:600,])
structure(list(`Date & Time [Local]` = c("06/12/2018 00:00", 
"06/12/2018 00:04", "06/12/2018 00:08", "06/12/2018 00:12", "06/12/2018 00:16", 
"06/12/2018 00:20", "06/12/2018 00:24", "06/12/2018 00:28", "06/12/2018 00:32", 
"06/12/2018 00:36", "06/12/2018 00:40", "06/12/2018 00:44", "06/12/2018 00:48", 
"06/12/2018 00:52", "06/12/2018 00:56", "06/12/2018 01:00", "06/12/2018 01:04", 
"06/12/2018 01:08", "06/12/2018 01:12", "06/12/2018 01:16", "06/12/2018 01:20", 
"06/12/2018 01:24", "06/12/2018 01:28", "06/12/2018 01:32", "06/12/2018 01:36", 
"06/12/2018 01:40", "06/12/2018 01:44", "06/12/2018 01:48", "06/12/2018 01:52", 
"06/12/2018 01:56", "06/12/2018 02:00", "06/12/2018 02:04", "06/12/2018 02:08", 
"06/12/2018 02:12", "06/12/2018 02:16", "06/12/2018 02:20", "06/12/2018 02:24", 
"06/12/2018 02:28", "06/12/2018 02:32", "06/12/2018 02:36", "06/12/2018 02:40", 
"06/12/2018 02:44", "06/12/2018 02:48", "06/12/2018 02:52", "06/12/2018 02:56", 
"06/12/2018 03:00", "06/12/2018 03:04", "06/12/2018 03:08", "06/12/2018 03:12", 
"06/12/2018 03:16", "06/12/2018 03:20", "06/12/2018 03:24", "06/12/2018 03:28", 
"06/12/2018 03:32", "06/12/2018 03:36", "06/12/2018 03:40", "06/12/2018 03:44", 
"06/12/2018 03:48", "06/12/2018 03:52", "06/12/2018 03:56", "06/12/2018 04:00", 
"06/12/2018 04:04", "06/12/2018 04:08", "06/12/2018 04:12", "06/12/2018 04:16", 
"06/12/2018 04:20", "06/12/2018 04:24", "06/12/2018 04:28", "06/12/2018 04:32", 
"06/12/2018 04:36", "06/12/2018 04:40", "06/12/2018 04:44", "06/12/2018 04:48", 
"06/12/2018 04:52", "06/12/2018 04:56", "06/12/2018 05:00", "06/12/2018 05:04", 
"06/12/2018 05:08", "06/12/2018 05:12", "06/12/2018 05:16", "06/12/2018 05:20", 
"06/12/2018 05:24", "06/12/2018 05:28", "06/12/2018 05:32", "06/12/2018 05:36", 
"06/12/2018 05:40", "06/12/2018 05:44", "06/12/2018 05:48", "06/12/2018 05:52", 
"06/12/2018 05:56", "06/12/2018 06:00", "06/12/2018 06:04", "06/12/2018 06:08", 
"06/12/2018 06:12", "06/12/2018 06:16", "06/12/2018 06:20", "06/12/2018 06:24", 
"06/12/2018 06:28", "06/12/2018 06:32", "06/12/2018 06:36", "06/12/2018 06:40", 
"06/12/2018 06:44", "06/12/2018 06:48", "06/12/2018 06:52", "06/12/2018 06:56", 
"06/12/2018 07:00", "06/12/2018 07:04", "06/12/2018 07:08", "06/12/2018 07:12", 
"06/12/2018 07:16", "06/12/2018 07:20", "06/12/2018 07:24", "06/12/2018 07:28", 
"06/12/2018 07:32", "06/12/2018 07:36", "06/12/2018 07:40", "06/12/2018 07:44", 
"06/12/2018 07:48", "06/12/2018 07:52", "06/12/2018 07:56", "06/12/2018 08:00", 
"06/12/2018 08:04", "06/12/2018 08:08", "06/12/2018 08:12", "06/12/2018 08:16", 
"06/12/2018 08:20", "06/12/2018 08:24", "06/12/2018 08:28", "06/12/2018 08:32", 
"06/12/2018 08:36", "06/12/2018 08:40", "06/12/2018 08:44", "06/12/2018 08:48", 
"06/12/2018 08:52", "06/12/2018 08:55", "06/12/2018 09:00", "06/12/2018 09:03", 
"06/12/2018 09:08", "06/12/2018 09:12", "06/12/2018 09:16", "06/12/2018 09:20", 
"06/12/2018 09:24", "06/12/2018 09:28", "06/12/2018 09:32", "06/12/2018 09:36", 
"06/12/2018 09:39", "06/12/2018 09:44", "06/12/2018 09:48", "06/12/2018 09:52", 
"06/12/2018 09:56", "06/12/2018 10:00", "06/12/2018 10:04", "06/12/2018 10:08", 
"06/12/2018 10:12", "06/12/2018 10:16", "06/12/2018 10:20", "06/12/2018 10:24", 
"06/12/2018 10:28", "06/12/2018 10:32", "06/12/2018 10:36", "06/12/2018 10:40", 
"06/12/2018 10:44", "06/12/2018 10:48", "06/12/2018 10:52", "06/12/2018 10:56", 
"06/12/2018 11:00", "06/12/2018 11:04", "06/12/2018 11:08", "06/12/2018 11:12", 
"06/12/2018 11:16", "06/12/2018 11:20", "06/12/2018 11:24", "06/12/2018 11:28", 
"06/12/2018 11:32", "06/12/2018 11:36", "06/12/2018 11:40", "06/12/2018 11:44", 
"06/12/2018 11:48", "06/12/2018 11:52", "06/12/2018 11:56", "06/12/2018 12:00", 
"06/12/2018 12:04", "06/12/2018 12:08", "06/12/2018 12:12", "06/12/2018 12:16", 
"06/12/2018 12:20", "06/12/2018 12:24", "06/12/2018 12:28", "06/12/2018 12:32", 
"06/12/2018 12:36", "06/12/2018 12:40", "06/12/2018 12:44", "06/12/2018 12:48", 
"06/12/2018 12:52", "06/12/2018 12:56", "06/12/2018 13:00", "06/12/2018 13:04", 
"06/12/2018 13:08", "06/12/2018 13:12", "06/12/2018 13:16", "06/12/2018 13:20", 
"06/12/2018 13:24", "06/12/2018 13:28", "06/12/2018 13:32", "06/12/2018 13:36", 
"06/12/2018 13:40", "06/12/2018 13:44", "06/12/2018 13:48", "06/12/2018 13:52", 
"06/12/2018 13:56", "06/12/2018 14:00", "06/12/2018 14:04", "06/12/2018 14:08", 
"06/12/2018 14:12", "06/12/2018 14:16", "06/12/2018 14:20", "06/12/2018 14:24", 
"06/12/2018 14:28", "06/12/2018 14:32", "06/12/2018 14:36", "06/12/2018 14:40", 
"06/12/2018 14:44", "06/12/2018 14:48", "06/12/2018 14:52", "06/12/2018 14:56", 
"06/12/2018 15:00", "06/12/2018 15:04", "06/12/2018 15:08", "06/12/2018 15:12", 
"06/12/2018 15:16", "06/12/2018 15:20", "06/12/2018 15:24", "06/12/2018 15:28", 
"06/12/2018 15:32", "06/12/2018 15:36", "06/12/2018 15:40", "06/12/2018 15:44", 
"06/12/2018 15:48", "06/12/2018 15:52", "06/12/2018 15:56", "06/12/2018 16:00", 
"06/12/2018 16:04", "06/12/2018 16:08", "06/12/2018 16:12", "06/12/2018 16:16", 
"06/12/2018 16:20", "06/12/2018 16:24", "06/12/2018 16:28", "06/12/2018 16:32", 
"06/12/2018 16:36", "06/12/2018 16:40", "06/12/2018 16:44", "06/12/2018 16:48", 
"06/12/2018 16:52", "06/12/2018 16:56", "06/12/2018 17:00", "06/12/2018 17:04", 
"06/12/2018 17:08", "06/12/2018 17:12", "06/12/2018 17:16", "06/12/2018 17:20", 
"06/12/2018 17:24", "06/12/2018 17:28", "06/12/2018 17:32", "06/12/2018 17:36", 
"06/12/2018 17:40", "06/12/2018 17:44", "06/12/2018 17:48", "06/12/2018 17:52", 
"06/12/2018 17:56", "06/12/2018 18:00", "06/12/2018 18:04", "06/12/2018 18:08", 
"06/12/2018 18:12", "06/12/2018 18:16", "06/12/2018 18:20", "06/12/2018 18:24", 
"06/12/2018 18:28", "06/12/2018 18:32", "06/12/2018 18:36", "06/12/2018 18:40", 
"06/12/2018 18:44", "06/12/2018 18:48", "06/12/2018 18:52", "06/12/2018 18:56", 
"06/12/2018 19:00", "06/12/2018 19:04", "06/12/2018 19:08", "06/12/2018 19:12", 
"06/12/2018 19:16", "06/12/2018 19:20", "06/12/2018 19:24", "06/12/2018 19:28", 
"06/12/2018 19:32", "06/12/2018 19:36", "06/12/2018 19:40", "06/12/2018 19:44", 
"06/12/2018 19:48", "06/12/2018 19:52", "06/12/2018 19:56", "06/12/2018 20:00", 
"06/12/2018 20:04", "06/12/2018 20:08", "06/12/2018 20:12", "06/12/2018 20:16", 
"06/12/2018 20:20", "06/12/2018 20:24", "06/12/2018 20:28", "06/12/2018 20:32", 
"06/12/2018 20:36", "06/12/2018 20:40", "06/12/2018 20:44", "06/12/2018 20:48", 
"06/12/2018 20:52", "06/12/2018 20:56", "06/12/2018 21:00", "06/12/2018 21:04", 
"06/12/2018 21:08", "06/12/2018 21:12", "06/12/2018 21:16", "06/12/2018 21:20", 
"06/12/2018 21:24", "06/12/2018 21:28", "06/12/2018 21:32", "06/12/2018 21:36", 
"06/12/2018 21:40", "06/12/2018 21:44", "06/12/2018 21:48", "06/12/2018 21:52", 
"06/12/2018 21:56", "06/12/2018 22:00", "06/12/2018 22:04", "06/12/2018 22:08", 
"06/12/2018 22:12", "06/12/2018 22:16", "06/12/2018 22:20", "06/12/2018 22:24", 
"06/12/2018 22:28", "06/12/2018 22:32", "06/12/2018 22:36", "06/12/2018 22:40", 
"06/12/2018 22:44", "06/12/2018 22:48", "06/12/2018 22:52", "06/12/2018 22:56", 
"06/12/2018 23:00", "06/12/2018 23:04", "06/12/2018 23:08", "06/12/2018 23:12", 
"06/12/2018 23:16", "06/12/2018 23:20", "06/12/2018 23:24", "06/12/2018 23:28", 
"06/12/2018 23:32", "06/12/2018 23:36", "06/12/2018 23:40", "06/12/2018 23:44", 
"06/12/2018 23:48", "06/12/2018 23:52", "06/12/2018 23:56", "06/13/2018 00:00", 
"06/13/2018 00:04", "06/13/2018 00:08", "06/13/2018 00:12", "06/13/2018 00:16", 
"06/13/2018 00:20", "06/13/2018 00:24", "06/13/2018 00:28", "06/13/2018 00:32", 
"06/13/2018 00:36", "06/13/2018 00:40", "06/13/2018 00:44", "06/13/2018 00:48", 
"06/13/2018 00:52", "06/13/2018 00:56", "06/13/2018 01:00", "06/13/2018 01:04", 
"06/13/2018 01:08", "06/13/2018 01:12", "06/13/2018 01:16", "06/13/2018 01:20", 
"06/13/2018 01:24", "06/13/2018 01:28", "06/13/2018 01:32", "06/13/2018 01:36", 
"06/13/2018 01:40", "06/13/2018 01:44", "06/13/2018 01:48", "06/13/2018 01:52", 
"06/13/2018 01:56", "06/13/2018 02:00", "06/13/2018 02:04", "06/13/2018 02:08", 
"06/13/2018 02:12", "06/13/2018 02:16", "06/13/2018 02:20", "06/13/2018 02:24", 
"06/13/2018 02:28", "06/13/2018 02:32", "06/13/2018 02:36", "06/13/2018 02:40", 
"06/13/2018 02:44", "06/13/2018 02:48", "06/13/2018 02:52", "06/13/2018 02:56", 
"06/13/2018 03:00", "06/13/2018 03:04", "06/13/2018 03:08", "06/13/2018 03:12", 
"06/13/2018 03:16", "06/13/2018 03:20", "06/13/2018 03:24", "06/13/2018 03:28", 
"06/13/2018 03:32", "06/13/2018 03:36", "06/13/2018 03:40", "06/13/2018 03:44", 
"06/13/2018 03:48", "06/13/2018 03:52", "06/13/2018 03:56", "06/13/2018 04:00", 
"06/13/2018 04:04", "06/13/2018 04:08", "06/13/2018 04:12", "06/13/2018 04:16", 
"06/13/2018 04:20", "06/13/2018 04:24", "06/13/2018 04:28", "06/13/2018 04:32", 
"06/13/2018 04:36", "06/13/2018 04:40", "06/13/2018 04:44", "06/13/2018 04:48", 
"06/13/2018 04:52", "06/13/2018 04:56", "06/13/2018 05:00", "06/13/2018 05:04", 
"06/13/2018 05:08", "06/13/2018 05:12", "06/13/2018 05:16", "06/13/2018 05:20", 
"06/13/2018 05:24", "06/13/2018 05:28", "06/13/2018 05:32", "06/13/2018 05:36", 
"06/13/2018 05:40", "06/13/2018 05:44", "06/13/2018 05:48", "06/13/2018 05:52", 
"06/13/2018 05:56", "06/13/2018 06:00", "06/13/2018 06:04", "06/13/2018 06:08", 
"06/13/2018 06:12", "06/13/2018 06:16", "06/13/2018 06:20", "06/13/2018 06:24", 
"06/13/2018 06:28", "06/13/2018 06:32", "06/13/2018 06:36", "06/13/2018 06:40", 
"06/13/2018 06:44", "06/13/2018 06:48", "06/13/2018 06:52", "06/13/2018 06:56", 
"06/13/2018 07:00", "06/13/2018 07:04", "06/13/2018 07:08", "06/13/2018 07:12", 
"06/13/2018 07:16", "06/13/2018 07:20", "06/13/2018 07:24", "06/13/2018 07:28", 
"06/13/2018 07:32", "06/13/2018 07:36", "06/13/2018 07:40", "06/13/2018 07:44", 
"06/13/2018 07:48", "06/13/2018 07:52", "06/13/2018 07:56", "06/13/2018 08:00", 
"06/13/2018 08:04", "06/13/2018 08:08", "06/13/2018 08:12", "06/13/2018 08:16", 
"06/13/2018 08:20", "06/13/2018 08:24", "06/13/2018 08:28", "06/13/2018 08:32", 
"06/13/2018 08:36", "06/13/2018 08:40", "06/13/2018 08:44", "06/13/2018 08:48", 
"06/13/2018 08:52", "06/13/2018 08:56", "06/13/2018 09:00", "06/13/2018 09:04", 
"06/13/2018 09:08", "06/13/2018 09:12", "06/13/2018 09:16", "06/13/2018 09:20", 
"06/13/2018 09:24", "06/13/2018 09:28", "06/13/2018 09:32", "06/13/2018 09:36", 
"06/13/2018 09:40", "06/13/2018 09:44", "06/13/2018 09:48", "06/13/2018 09:52", 
"06/13/2018 09:56", "06/13/2018 10:00", "06/13/2018 10:04", "06/13/2018 10:08", 
"06/13/2018 10:12", "06/13/2018 10:16", "06/13/2018 10:20", "06/13/2018 10:24", 
"06/13/2018 10:28", "06/13/2018 10:32", "06/13/2018 10:36", "06/13/2018 10:40", 
"06/13/2018 10:44", "06/13/2018 10:48", "06/13/2018 10:52", "06/13/2018 10:56", 
"06/13/2018 11:00", "06/13/2018 11:04", "06/13/2018 11:08", "06/13/2018 11:12", 
"06/13/2018 11:16", "06/13/2018 11:20", "06/13/2018 11:24", "06/13/2018 11:28", 
"06/13/2018 11:32", "06/13/2018 11:36", "06/13/2018 11:40", "06/13/2018 11:44", 
"06/13/2018 11:48", "06/13/2018 11:52", "06/13/2018 11:56", "06/13/2018 12:00", 
"06/13/2018 12:04", "06/13/2018 12:08", "06/13/2018 12:12", "06/13/2018 12:16", 
"06/13/2018 12:20", "06/13/2018 12:24", "06/13/2018 12:28", "06/13/2018 12:32", 
"06/13/2018 12:36", "06/13/2018 12:40", "06/13/2018 12:44", "06/13/2018 12:48", 
"06/13/2018 12:52", "06/13/2018 12:56", "06/13/2018 13:00", "06/13/2018 13:04", 
"06/13/2018 13:08", "06/13/2018 13:12", "06/13/2018 13:16", "06/13/2018 13:20", 
"06/13/2018 13:24", "06/13/2018 13:28", "06/13/2018 13:32", "06/13/2018 13:36", 
"06/13/2018 13:40", "06/13/2018 13:44", "06/13/2018 13:48", "06/13/2018 13:52", 
"06/13/2018 13:56", "06/13/2018 14:00", "06/13/2018 14:04", "06/13/2018 14:08", 
"06/13/2018 14:12", "06/13/2018 14:16", "06/13/2018 14:20", "06/13/2018 14:24", 
"06/13/2018 14:28", "06/13/2018 14:32", "06/13/2018 14:36", "06/13/2018 14:40", 
"06/13/2018 14:44", "06/13/2018 14:48", "06/13/2018 14:52", "06/13/2018 14:56", 
"06/13/2018 15:00", "06/13/2018 15:04", "06/13/2018 15:08", "06/13/2018 15:12", 
"06/13/2018 15:16", "06/13/2018 15:20", "06/13/2018 15:24", "06/13/2018 15:28", 
"06/13/2018 15:32", "06/13/2018 15:36", "06/13/2018 15:40", "06/13/2018 15:44", 
"06/13/2018 15:48", "06/13/2018 15:52", "06/13/2018 15:56"), 
    Latitude = c(-2.4310708, -2.4309536, -2.43089, -2.4309269, 
    -2.4309269, -2.4309086, -2.4307103, -2.4307103, -2.4307103, 
    -2.4307189, -2.4307183, -2.4307183, -2.4307094, -2.4307097, 
    -2.4307192, -2.4307192, -2.4307103, -2.43071, -2.4307197, 
    -2.4307108, -2.4307106, -2.43072, -2.4307106, -2.4307197, 
    -2.4307103, -2.4307194, -2.4307103, -2.43071, -2.4307114, 
    -2.43071, -2.4307008, -2.4307197, -2.43072, -2.4307011, -2.4307103, 
    -2.4307011, -2.4307019, -2.4307017, -2.4307019, -2.4307003, 
    -2.4306744, -2.4307725, -2.4307458, -2.4307458, -2.4307464, 
    -2.430755, -2.4307547, -2.4307544, -2.4307533, -2.4307458, 
    -2.4307628, -2.4307531, -2.4307453, -2.4307539, -2.4307714, 
    -2.4307447, -2.4307533, -2.4307628, -2.4307447, -2.4307536, 
    -2.4307453, -2.430755, -2.4307433, -2.4307628, -2.4307447, 
    -2.4307633, -2.4307453, -2.4307717, -2.4307453, -2.4307711, 
    -2.4307553, -2.4307633, -2.4307636, -2.4307992, -2.4307467, 
    -2.4307925, -2.4307644, -2.4308731, -2.4308906, -2.4308814, 
    -2.4308811, -2.4308897, -2.4308983, -2.4308897, -2.4308814, 
    -2.4308978, -2.4308819, -2.4308814, -2.4308983, -2.4308919, 
    -2.4308925, -2.4308994, -2.4310094, -2.4310992, -2.4310875, 
    -2.4309725, -2.4309547, -2.4308642, -2.4308361, -2.4307722, 
    -2.4307731, -2.4307567, -2.4307444, -2.4307281, -2.4306828, 
    -2.4306439, -2.4304544, -2.4305017, -2.4305197, -2.4304636, 
    -2.4304281, -2.4304267, -2.4304258, -2.4304353, -2.4304267, 
    -2.4304267, -2.43039, -2.4303725, -2.4303636, -2.4302189, 
    -2.4297944, -2.4298314, -2.4298944, -2.4299758, -2.4300219, 
    -2.4300483, -2.4300847, -2.4301208, -2.4300589, -2.4300492, 
    -2.4301214, -2.4302036, -2.4302669, -2.4302769, -2.4301314, 
    -2.4301136, -2.4301133, -2.4301403, -2.4302139, -2.4302072, 
    -2.430305, -2.4302833, -2.4303022, -2.4302853, -2.4303481, 
    -2.4304183, -2.4304542, -2.4304292, -2.4303308, -2.4302983, 
    -2.4303064, -2.4303128, -2.4303758, -2.4303933, -2.4304489, 
    -2.4302947, -2.4302753, -2.4300047, -2.430005, -2.4299953, 
    -2.4300128, -2.4300114, -2.4299933, -2.429985, -2.42996, 
    -2.4299319, -2.429905, -2.4298689, -2.42976, -2.4296783, 
    -2.4294419, -2.4293978, -2.4294583, -2.4294161, -2.4294253, 
    -2.4294136, -2.4294461, -2.4294192, -2.4294231, -2.4294333, 
    -2.429455, -2.429465, -2.4294286, -2.42943, -2.4294122, -2.42942, 
    -2.4280822, -2.4263161, -2.4256733, -2.4257117, -2.4257197, 
    -2.4257192, -2.4257283, -2.4257192, -2.4257192, -2.42571, 
    -2.4257628, -2.4259889, -2.425715, -2.4251744, -2.4251461, 
    -2.4249656, -2.4248372, -2.4251992, -2.4251611, -2.425345, 
    -2.4251381, -2.4250006, -2.4250106, -2.4250378, -2.4251731, 
    -2.4255803, -2.4255811, -2.4255794, -2.4256186, -2.4256275, 
    -2.4256175, -2.4255636, -2.4255983, -2.4255542, -2.4255, 
    -2.4254381, -2.4254369, -2.4253469, -2.4253367, -2.4253833, 
    -2.4253547, -2.4250386, -2.4251367, -2.4250828, -2.4251925, 
    -2.4252106, -2.4251567, -2.4251906, -2.4251831, -2.4251669, 
    -2.4251942, -2.4253278, -2.4252836, -2.42531, -2.4252642, 
    -2.4252467, -2.4252492, -2.4252847, -2.4252453, -2.4252017, 
    -2.4252297, -2.4252311, -2.4252675, -2.4252644, -2.4250825, 
    -2.4250733, -2.4250644, -2.4250642, -2.4256619, -2.4255539, 
    -2.426015, -2.4263419, -2.4256794, -2.4256711, -2.4256536, 
    -2.4256617, -2.4256614, -2.4256619, -2.4256614, -2.4256614, 
    -2.4256608, -2.4256703, -2.4256606, -2.4256703, -2.4256608, 
    -2.4256694, -2.4256694, -2.4256608, -2.4258508, -2.4259669, 
    -2.4261397, -2.4263117, -2.4263133, -2.4263942, -2.4264297, 
    -2.4264306, -2.42643, -2.4264219, -2.4264486, -2.4264486, 
    -2.4266114, -2.4270375, -2.42702, -2.4270008, -2.4269922, 
    -2.4270564, -2.4270381, -2.4270192, -2.4269739, -2.4269825, 
    -2.4270106, -2.4270103, -2.4270008, -2.4272189, -2.4272372, 
    -2.4272383, -2.4272547, -2.4271997, -2.4271919, -2.4272097, 
    -2.4271917, -2.4272011, -2.4271919, -2.4271925, -2.4272014, 
    -2.42721, -2.4272278, -2.4272911, -2.4273728, -2.4274369, 
    -2.4274814, -2.4274728, -2.4274817, -2.4274814, -2.4274814, 
    -2.4274819, -2.4274719, -2.4274814, -2.4274828, -2.4275453, 
    -2.4276447, -2.4276453, -2.4276364, -2.427645, -2.4276617, 
    -2.4276531, -2.4276525, -2.4276531, -2.4276444, -2.4276436, 
    -2.4279442, -2.4281614, -2.4286594, -2.4287228, -2.4287136, 
    -2.4284331, -2.4276722, -2.4275811, -2.4275811, -2.42759, 
    -2.4275908, -2.4275814, -2.4275803, -2.4276086, -2.4276803, 
    -2.4276806, -2.4276625, -2.4276528, -2.4276642, -2.4276722, 
    -2.4276731, -2.4276631, -2.4276725, -2.4276736, -2.4276725, 
    -2.4275725, -2.4275725, -2.4274728, -2.427455, -2.427455, 
    -2.427455, -2.4275094, -2.4274997, -2.4275361, -2.4275278, 
    -2.4275817, -2.4276728, -2.4276714, -2.4276806, -2.4276631, 
    -2.4276725, -2.4276722, -2.4276814, -2.4276631, -2.4276717, 
    -2.4276722, -2.4276633, -2.4276722, -2.4276728, -2.4276628, 
    -2.4276636, -2.4276725, -2.4276722, -2.4276728, -2.4276622, 
    -2.4277356, -2.4278892, -2.4286333, -2.4283703, -2.4279714, 
    -2.4283514, -2.4287414, -2.4286506, -2.4284331, -2.4284694, 
    -2.4287328, -2.4286783, -2.4286597, -2.4286961, -2.4286769, 
    -2.4286856, -2.4286869, -2.4286772, -2.4286686, -2.4286853, 
    -2.4287042, -2.4287044, -2.4287044, -2.4287044, -2.428705, 
    -2.4287044, -2.4286861, -2.4287128, -2.4286592, -2.4286583, 
    -2.4286678, -2.4286586, -2.4286594, -2.4286589, -2.4286578, 
    -2.4286586, -2.4286586, -2.4286581, -2.4286586, -2.4286661, 
    -2.4287217, -2.4286494, -2.4286483, -2.4286483, -2.4286575, 
    -2.4286522, -2.4286511, -2.4286511, -2.4286511, -2.4286514, 
    -2.4286522, -2.4286519, -2.4286525, -2.4286522, -2.4286519, 
    -2.4286525, -2.4286514, -2.4286519, -2.4287058, -2.4286969, 
    -2.428705, -2.4282342, -2.4277075, -2.4276178, -2.4276089, 
    -2.4275092, -2.4274192, -2.4272097, -2.4279175, -2.4285875, 
    -2.4286511, -2.4286417, -2.4286589, -2.42913, -2.4299256, 
    -2.4302689, -2.4304142, -2.4304961, -2.4304942, -2.4305853, 
    -2.4305939, -2.4305933, -2.4305836, -2.4305939, -2.4305836, 
    -2.4305936, -2.4305925, -2.4305842, -2.4305744, -2.4305911, 
    -2.4305922, -2.4306564, -2.4306639, -2.4306647, -2.4306558, 
    -2.4306825, -2.4306639, -2.4306461, -2.4306458, -2.4307636, 
    -2.4307356, -2.430745, -2.4307278, -2.4307283, -2.4307189, 
    -2.4307206, -2.4307292, -2.4307383, -2.4307297, -2.4307378, 
    -2.4307289, -2.4307219, -2.4307386, -2.43072, -2.4307203, 
    -2.4307375, -2.43072, -2.4307314, -2.4294008, -2.42931, -2.4293111, 
    -2.4293108, -2.4293094, -2.4293117, -2.4291919, -2.4292108, 
    -2.4292025, -2.4291928, -2.4292206, -2.4292111, -2.4292117, 
    -2.4292103, -2.4292108, -2.4292111, -2.4292117, -2.4292031, 
    -2.4292111, -2.4292114, -2.4292117, -2.4292108, -2.4292111, 
    -2.4292019, -2.4292117, -2.4292219, -2.4292117, -2.4292208, 
    -2.42922, -2.4292197, -2.4292114, -2.4292206, -2.4292194, 
    -2.4292203, -2.4292031, -2.4292211, -2.4292194, -2.4292219, 
    -2.4292281, -2.4292197, -2.4292208, -2.4292131, -2.4291403, 
    -2.4291483, -2.4291519, -2.4291489, -2.4291478, -2.4291475, 
    -2.4291478, -2.4292017, -2.4292383, -2.4292283, -2.4292017, 
    -2.4292289, -2.4292469, -2.4292381, -2.4292289, -2.4292297, 
    -2.4292467, -2.4292553, -2.4292556, -2.4292353, -2.4292286, 
    -2.4292211, -2.4291464, -2.4291464, -2.4291461, -2.4291383, 
    -2.4291456, -2.4291383, -2.4291478, -2.4291475, -2.4291386, 
    -2.4291478, -2.4291489, -2.4291486, -2.42928, -2.4293403, 
    -2.4293789, -2.429355, -2.4293481, -2.4301889, -2.4307772, 
    -2.4307772, -2.4307944, -2.4308636, -2.4307417, -2.43075, 
    -2.4307497, -2.4307589, -2.4307503), Longitude = c(34.8549169, 
    34.8546903, 34.8546275, 34.8546056, 34.8546056, 34.8546056, 
    34.8547725, 34.8547725, 34.854785, 34.8547875, 34.8547822, 
    34.8547822, 34.8547822, 34.8547875, 34.8547725, 34.8547725, 
    34.854785, 34.85478, 34.8547703, 34.8547828, 34.8547903, 
    34.8547631, 34.8547903, 34.8547828, 34.8547725, 34.8547778, 
    34.854785, 34.85478, 34.8547806, 34.85478, 34.8547875, 34.8547703, 
    34.8547756, 34.854785, 34.854785, 34.854785, 34.8547631, 
    34.8547828, 34.8547631, 34.8548022, 34.8548675, 34.8548994, 
    34.8548847, 34.8548522, 34.85485, 34.8548647, 34.8548719, 
    34.8548994, 34.8548714, 34.8548719, 34.8548767, 34.8548789, 
    34.8548744, 34.8548892, 34.8548714, 34.8548692, 34.8548714, 
    34.8548692, 34.8548892, 34.8548767, 34.8548869, 34.8548772, 
    34.8548883, 34.8548892, 34.8548892, 34.8548869, 34.8548869, 
    34.8548767, 34.8548869, 34.8548861, 34.8548697, 34.8548744, 
    34.8548919, 34.8548617, 34.8548875, 34.8548528, 34.85485, 
    34.854875, 34.8548647, 34.8548647, 34.8548719, 34.8548744, 
    34.8548692, 34.8548744, 34.8548522, 34.8548714, 34.85485, 
    34.8548647, 34.8548692, 34.8548778, 34.8548558, 34.8548647, 
    34.8549103, 34.854945, 34.8549561, 34.8549847, 34.854925, 
    34.8549647, 34.8549169, 34.8549067, 34.8548972, 34.8548256, 
    34.8548642, 34.854825, 34.8547875, 34.8547014, 34.8547264, 
    34.8547175, 34.8546925, 34.8546939, 34.8547042, 34.8547036, 
    34.8547008, 34.8547183, 34.8547036, 34.8547036, 34.8546858, 
    34.8546836, 34.8546764, 34.8545739, 34.8540181, 34.8539311, 
    34.8539061, 34.8538861, 34.8538117, 34.8537889, 34.8537617, 
    34.8537942, 34.8538272, 34.8538367, 34.8536297, 34.8533683, 
    34.8533483, 34.8533439, 34.8533358, 34.8532564, 34.8531739, 
    34.8531364, 34.8528978, 34.8528689, 34.8528756, 34.8529036, 
    34.8528992, 34.8528947, 34.8529744, 34.8529436, 34.8529258, 
    34.8529817, 34.8529, 34.8528917, 34.8528761, 34.852855, 34.8528875, 
    34.8529544, 34.8529875, 34.8529, 34.8529317, 34.8524906, 
    34.8524183, 34.8524206, 34.8524428, 34.8524619, 34.8524419, 
    34.8524522, 34.8524758, 34.8524406, 34.8524081, 34.8524206, 
    34.8523581, 34.8522956, 34.8520306, 34.8521033, 34.8520444, 
    34.8520383, 34.8520111, 34.8519972, 34.8520647, 34.8520575, 
    34.8520725, 34.8520681, 34.8520647, 34.8520553, 34.8520428, 
    34.8520308, 34.8519836, 34.8519631, 34.8525736, 34.8524642, 
    34.8523539, 34.8518411, 34.8518258, 34.8518281, 34.8518281, 
    34.8518281, 34.8518353, 34.8518353, 34.8518022, 34.8518397, 
    34.8515617, 34.8515175, 34.8516964, 34.8518061, 34.8522142, 
    34.8521794, 34.8521811, 34.8519608, 34.8513503, 34.8513717, 
    34.8513672, 34.8513472, 34.8513872, 34.8513325, 34.8513481, 
    34.8513422, 34.8513161, 34.8513236, 34.8513281, 34.8513008, 
    34.851345, 34.8510314, 34.8509989, 34.8509547, 34.8509914, 
    34.8510092, 34.8510211, 34.8511114, 34.8513053, 34.8516669, 
    34.8518008, 34.8518261, 34.8518789, 34.8518789, 34.8519489, 
    34.8519453, 34.8519511, 34.8519494, 34.8519297, 34.8518214, 
    34.8518494, 34.8518392, 34.8518811, 34.8519114, 34.8518875, 
    34.851825, 34.8520853, 34.8521358, 34.8520867, 34.8520872, 
    34.8521322, 34.8523775, 34.8522272, 34.8522147, 34.8522272, 
    34.8522222, 34.8517317, 34.8511358, 34.8502683, 34.8497131, 
    34.85039, 34.8503878, 34.8503656, 34.85037, 34.850365, 34.8503628, 
    34.850365, 34.8503775, 34.8503672, 34.850365, 34.8503619, 
    34.850365, 34.8503472, 34.8503494, 34.8503619, 34.8503347, 
    34.8499136, 34.8496611, 34.8495394, 34.8490806, 34.8490792, 
    34.8490039, 34.8489936, 34.8489967, 34.8489989, 34.8489819, 
    34.8490164, 34.8489967, 34.8489892, 34.8490997, 34.84911, 
    34.8491144, 34.8491319, 34.8491797, 34.8492069, 34.8491842, 
    34.8491842, 34.8491992, 34.8492667, 34.8493067, 34.8493139, 
    34.8491997, 34.8492172, 34.8492128, 34.8492197, 34.8491592, 
    34.8491475, 34.8491422, 34.8491422, 34.8491525, 34.84914, 
    34.8491453, 34.8491775, 34.8491922, 34.8491997, 34.8492447, 
    34.8493397, 34.8494397, 34.8494744, 34.8494994, 34.8494544, 
    34.8494619, 34.8494494, 34.8494597, 34.8494642, 34.8494419, 
    34.84945, 34.8494197, 34.84931, 34.8492953, 34.8492881, 34.8492903, 
    34.8493219, 34.8492997, 34.8493094, 34.8493072, 34.849305, 
    34.8493219, 34.8493306, 34.8493933, 34.8494264, 34.8490969, 
    34.8490197, 34.848835, 34.8487342, 34.8486989, 34.8486989, 
    34.8486989, 34.8487017, 34.8487039, 34.8486886, 34.8487417, 
    34.8488858, 34.8489108, 34.8488983, 34.8489006, 34.8488917, 
    34.8488889, 34.8488917, 34.8488961, 34.8488814, 34.8488769, 
    34.8488939, 34.8488711, 34.8488711, 34.8488858, 34.8488836, 
    34.8488911, 34.8488711, 34.8488439, 34.8488536, 34.8488461, 
    34.8488114, 34.8488514, 34.8488867, 34.8488983, 34.8488983, 
    34.8489086, 34.8488939, 34.8488889, 34.8488889, 34.8488961, 
    34.8488911, 34.8488889, 34.8488889, 34.8489014, 34.8488867, 
    34.8488836, 34.8488867, 34.8488939, 34.8488889, 34.8488867, 
    34.8488933, 34.8489911, 34.8495022, 34.8498881, 34.8494211, 
    34.8493756, 34.8494108, 34.8496633, 34.8494389, 34.8492489, 
    34.8494286, 34.8495389, 34.8495014, 34.8494064, 34.8494114, 
    34.8492489, 34.8492561, 34.8492444, 34.8492017, 34.8491942, 
    34.8491936, 34.8491967, 34.8492142, 34.8492142, 34.8492142, 
    34.8492119, 34.8492142, 34.8492414, 34.8491789, 34.8491767, 
    34.8491539, 34.8491392, 34.8491464, 34.8492142, 34.8492164, 
    34.8492208, 34.8492114, 34.8492114, 34.8492136, 34.8492114, 
    34.8492106, 34.8491989, 34.8491789, 34.8491708, 34.8491583, 
    34.8491508, 34.8491678, 34.8491847, 34.8491847, 34.8491722, 
    34.8491772, 34.8491803, 34.849175, 34.8491728, 34.8491678, 
    34.8491625, 34.8491728, 34.8491772, 34.8491625, 34.8492022, 
    34.849195, 34.8492642, 34.8495531, 34.8497961, 34.8500258, 
    34.8500258, 34.8499883, 34.8499361, 34.850065, 34.8505303, 
    34.8510919, 34.8510772, 34.8510722, 34.8510817, 34.8512119, 
    34.8513194, 34.8516289, 34.8516964, 34.8517717, 34.8517731, 
    34.8519181, 34.8519206, 34.8519028, 34.8519125, 34.8518881, 
    34.8519322, 34.8518828, 34.8519197, 34.8518903, 34.8519197, 
    34.8519514, 34.8518947, 34.8518653, 34.8519294, 34.8519197, 
    34.8518875, 34.8518947, 34.8519367, 34.8519022, 34.8519294, 
    34.8519869, 34.8519839, 34.8520017, 34.8519844, 34.8520022, 
    34.8519972, 34.8520028, 34.8519853, 34.8519853, 34.8519831, 
    34.8520075, 34.852, 34.8519911, 34.8519903, 34.852005, 34.8519853, 
    34.8520147, 34.852005, 34.8519961, 34.85098, 34.8507828, 
    34.8507833, 34.8507658, 34.850785, 34.8507561, 34.850785, 
    34.8507681, 34.8507658, 34.8507681, 34.8507783, 34.8507606, 
    34.8507708, 34.85079, 34.8507753, 34.8507806, 34.8507783, 
    34.8507561, 34.8507606, 34.8507856, 34.8507783, 34.8507753, 
    34.8507806, 34.8507806, 34.8507908, 34.8507464, 34.8507783, 
    34.8507908, 34.8507806, 34.8507878, 34.8507731, 34.8507658, 
    34.85079, 34.8507856, 34.8507886, 34.8507886, 34.8507828, 
    34.8507914, 34.85074, 34.8507753, 34.8507833, 34.8507589, 
    34.8507936, 34.8507908, 34.8508022, 34.8507886, 34.8507806, 
    34.8507878, 34.8507806, 34.850905, 34.8509353, 34.8509122, 
    34.8509175, 34.8509175, 34.85095, 34.8509425, 34.85093, 34.8509328, 
    34.8509375, 34.8509397, 34.8509572, 34.8509861, 34.85095, 
    34.8509381, 34.8508894, 34.8508769, 34.8508969, 34.850885, 
    34.8508867, 34.8508725, 34.8508903, 34.8508725, 34.8508653, 
    34.8508578, 34.8508733, 34.8508608, 34.8509111, 34.8508267, 
    34.8508611, 34.8508475, 34.8508586, 34.8512553, 34.8515603, 
    34.8515478, 34.8515247, 34.8515058, 34.8515453, 34.8515675, 
    34.8515625, 34.851575, 34.8515603)), row.names = c(NA, -600L
), class = c("data.table", "data.frame"), .internal.selfref = <pointer: 0x0000000002631ef0>)

感谢您的帮助!

2 个答案:

答案 0 :(得分:4)

应为mdy_hm。没有13月份,因此dmy_hm将在06/13/2018 00:00及其之后的任何行上失败。

library(data.table)
library(lubridate)

datanet1 <- datanet[, DateTime := mdy_hm(`Date & Time [Local]`)]

答案 1 :(得分:3)

anytime::anytime将通过检查数据来选择适当的格式,并且@www回答时,这是格式错误的情况

library(anytime)
datanet[, DateTime := anytime(`Date & Time [Local]`)]
any(is.na(datanet$DateTime))
#[1] FALSE