当我将时间日期列(dateWw)转换为POSIXct(列dateW)时,前两行变为重复,而原始列中的奇数毫秒变为偶数(例如,第3行和第4行)。
options(digits.secs=5)
jalpy$dateW <- as.POSIXct(jalp$dateWw, format = "%Y-%m-%d %H:%M:%OS", tz="GMT")
> head(jalpy)
dateWw dateW depth
1 2016-06-15 02:09:27.00 2016-06-15 02:09:27.00 0.0900
2 2016-06-15 02:09:27.01 2016-06-15 02:09:27.00 0.0898
3 2016-06-15 02:09:27.05 2016-06-15 02:09:27.04 0.0894
4 2016-06-15 02:09:27.09 2016-06-15 02:09:27.08 0.0890
5 2016-06-15 02:09:27.16 2016-06-15 02:09:27.16 0.0884
6 2016-06-15 02:09:27.20 2016-06-15 02:09:27.20 0.0880
> str(jalpy)
'data.frame': 872976 obs. of 3 variables:
$ dateWw: chr "2016-06-15 02:09:27.00" "2016-06-15 02:09:27.01" "2016-06-15 02:09:27.05" "2016-06-15 02:09:27.09" ...
$ dateW : POSIXct, format: "2016-06-15 02:09:27.00" "2016-06-15 02:09:27.00" "2016-06-15 02:09:27.04" ...
$ depth : num 0.09 0.0898 0.0894 0.089 0.0884 ...
>
我已尝试将我的数据从epoch时间,POSIXlt转换为POSIXct并使用lubridate包,但它们都会产生相同的结果。
只是想知道是否有人之前遇到过此问题且知道解决方案?
谢谢!
格雷斯