我有以下带有 indexClass“日期”的xts对象。index(data)
给了我“POSIXct”对象。我认为index(Data)
会返回一个“日期”对象。
如何从中获取“日期”对象index()
?
str(data)
An ‘xts’ object from 2007-01-15 to 2012-04-27 containing:
Data: num [1:1282, 1:5] 1881 2003 2064 2026 2098 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "open" "high" "low" "close" ...
Indexed by objects of class: [Date] TZ: GMT
xts Attributes:
List of 2
$ tclass: chr "Date"
$ tzone : chr "GMT"
indexClass(data)
"Date"
str(index(data))
Class 'POSIXct' atomic [1:1282] 1.17e+09 1.17e+09 1.17e+09 1.17e+09 1.17e+09 ...
..- attr(*, "tzone")= chr "GMT"
..- attr(*, "tclass")= chr "Date"