它看起來像POSIXlt允許毫秒精度規格,但是我有在XTS對象設定一個0.001毫秒索引值時的問題:řXTS:0.001毫秒索引
> options(digits.secs = 3)
> data(sample_matrix)
> sample.xts = xts(sample_matrix, rep(as.POSIXlt("2012-03-20 09:02:50.001"), 180))
> head(sample.xts, 10)
Open High Low Close
2012-03-20 09:02:50.000 50.03978 50.11778 49.95041 50.11778
2012-03-20 09:02:50.000 50.23050 50.42188 50.23050 50.39767
2012-03-20 09:02:50.000 50.42096 50.42096 50.26414 50.33236
2012-03-20 09:02:50.000 50.37347 50.37347 50.22103 50.33459
2012-03-20 09:02:50.000 50.24433 50.24433 50.11121 50.18112
2012-03-20 09:02:50.000 50.13211 50.21561 49.99185 49.99185
2012-03-20 09:02:50.000 50.03555 50.10363 49.96971 49.98806
2012-03-20 09:02:50.000 49.99489 49.99489 49.80454 49.91333
2012-03-20 09:02:50.000 49.91228 50.13053 49.91228 49.97246
2012-03-20 09:02:50.000 49.88529 50.23910 49.88529 50.23910
> sample.xts = xts(sample_matrix, rep(as.POSIXlt("2012-03-20 09:02:50.002"), 180))
> head(sample.xts, 10)
Open High Low Close
2012-03-20 09:02:50.002 50.03978 50.11778 49.95041 50.11778
2012-03-20 09:02:50.002 50.23050 50.42188 50.23050 50.39767
2012-03-20 09:02:50.002 50.42096 50.42096 50.26414 50.33236
2012-03-20 09:02:50.002 50.37347 50.37347 50.22103 50.33459
2012-03-20 09:02:50.002 50.24433 50.24433 50.11121 50.18112
2012-03-20 09:02:50.002 50.13211 50.21561 49.99185 49.99185
2012-03-20 09:02:50.002 50.03555 50.10363 49.96971 49.98806
2012-03-20 09:02:50.002 49.99489 49.99489 49.80454 49.91333
2012-03-20 09:02:50.002 49.91228 50.13053 49.91228 49.97246
2012-03-20 09:02:50.002 49.88529 50.23910 49.88529 50.23910
爲什麼001毫秒設置失敗?
你狹義的「問題」是,你做**不**做'選項(digits.secs = 6)'這樣你就不會看到你的決議指定顯示。從更廣泛的意義上說,對於最小的「epsilon」變化,你的問題是一個不適當的測試,但你可以在下面看到我的答案。 – 2012-03-20 17:07:06