【发布时间】:2012-03-20 20:45:49
【问题描述】:
如何创建索引包含毫秒的 xts 对象?我在 POSIXlt 帮助页面中找不到任何格式规范,但 indexFormat() 中有一个 reference 到 %OS。
更新
基于 Gavin zoo 答案的 xts 示例:
> options(digits.secs = 3)
> data(sample_matrix)
> sample.xts = xts(sample_matrix, Sys.time() + seq(0, by = 0.1, length = 180))
> head(sample.xts)
Open High Low Close
2012-03-20 08:49:02.820 50.03978 50.11778 49.95041 50.11778
2012-03-20 08:49:02.920 50.23050 50.42188 50.23050 50.39767
2012-03-20 08:49:03.020 50.42096 50.42096 50.26414 50.33236
2012-03-20 08:49:03.120 50.37347 50.37347 50.22103 50.33459
2012-03-20 08:49:03.220 50.24433 50.24433 50.11121 50.18112
2012-03-20 08:49:03.320 50.13211 50.21561 49.99185 49.99185
【问题讨论】: