我有以下形式的数据框
SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted
2007-01-03 142.25 142.86 140.57 141.37 94807600 125.38
2007-01-04 141.23 142.05 140.61 141.67 69620600 125.65
2007-01-05 141.33 141.40 140.38 140.54 76645300 124.64
2007-01-08 140.82 141.41 140.25 141.19 71655000 125.22
2007-01-09 141.31 141.60 140.40 141.07 75680100 125.11
2007-01-10 140.58 141.57 140.30 141.54 72428000 125.53
但是该命令index(DATA.FRAME)
返回整数而不是日期。我应该使用什么函数来获取日期列表而不是整数?
编辑:
dput(DATA.FRAME) 的输出是
structure(list(SPY.Open = c(142.25, 141.23, 141.33, 140.82, 141.31,
140.58), SPY.High = c(142.86, 142.05, 141.4, 141.41, 141.6, 141.57
), SPY.Low = c(140.57, 140.61, 140.38, 140.25, 140.4, 140.3),
SPY.Close = c(141.37, 141.67, 140.54, 141.19, 141.07, 141.54
), SPY.Volume = c(94807600, 69620600, 76645300, 71655000,
75680100, 72428000), SPY.Adjusted = c(125.38, 125.65, 124.64,
125.22, 125.11, 125.53)), .Names = c("SPY.Open", "SPY.High",
"SPY.Low", "SPY.Close", "SPY.Volume", "SPY.Adjusted"), row.names = c("2007-01-03",
"2007-01-04", "2007-01-05", "2007-01-08", "2007-01-09", "2007-01-10"
), class = "data.frame")