xts数据结构:
索引(时间)+数据(矩阵)+属性(包括隐藏属性和用户属性)
xts使用:
xts类型基本操作
作图
类型转换
数据处理‘
数据统计计算
时间序列工具使用
set.seed(1953)
data1 <- matrix(rnorm(22), ncol = 2)
now <- "2009-01-05"
xts(data1, as.Date(now) - 0:10)
data2 <- round(rnorm(24), 4)
# 月度数据
tm <- ts(data2, start = c(2008, 3), frequency = 12)
xm <- as.xts(tm)
xts['2007-03-01/2007']
作图
plot(as.xts(matrix))
K线图
plot(as.xts(matrix),type="candles")