R quantmod图表\u系列用NA值绘制系列

R quantmod图表\u系列用NA值绘制系列,r,plot,xts,quantmod,R,Plot,Xts,Quantmod,我有一个xts系列“a”,包含2015-09-10年上午9:30到下午13:00之间15分钟的OHLC和间谍数量,数值在下午13:00到下午4点之间为NA 我想用烛台下面的音量条来描绘整个系列 require(quantmod) a<-structure(c(194.48, 195.14, 194.84, 194.56, 194.57, 195.82, 195.89, 195.56, 195.06, 195.8, 195.79, 196.02, 195.58, 195.71, NA, N

我有一个
xts
系列“a”,包含2015-09-10年上午9:30到下午13:00之间15分钟的OHLC和间谍数量,数值在下午13:00到下午4点之间为NA

我想用烛台下面的音量条来描绘整个系列

require(quantmod)
a<-structure(c(194.48, 195.14, 194.84, 194.56, 194.57, 195.82, 195.89, 
195.56, 195.06, 195.8, 195.79, 196.02, 195.58, 195.71, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 195.37, 195.42, 194.87, 
194.95, 195.89, 196.32, 195.96, 195.57, 195.82, 195.95, 196.24, 
196.16, 195.95, 196.1499, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, 194.42, 194.64, 194.27, 194.25, 194.5595, 195.73, 
195.44, 194.86, 195.05, 195.405, 195.6, 195.465, 195.48, 195.699, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 195.141, 
194.84, 194.56, 194.56, 195.81, 195.9, 195.57, 195.05, 195.8, 
195.79, 196.01, 195.58, 195.72, 195.785, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, 8328828, 5188794, 5859222, 4854178, 
6374039, 5039393, 4419063, 5703169, 3504604, 3207277, 2999488, 
3774300, 2385201, 2212837, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA), .Dim = c(27L, 5L), .Dimnames = list(NULL, c("Open", 
"High", "Low", "Close", "Volume")), index = structure(c(1441892700, 
1441893600, 1441894500, 1441895400, 1441896300, 1441897200, 1441898100, 
1441899000, 1441899900, 1441900800, 1441901700, 1441902600, 1441903500, 
1441904400, 1441905300, 1441906200, 1441907100, 1441908000, 1441908900, 
1441909800, 1441910700, 1441911600, 1441912500, 1441913400, 1441914300, 
1441915200, 1441915500), tzone = "", tclass = c("POSIXct", "POSIXt"
)), tclass = c("POSIXct", "POSIXt"), tzone = "", .indexCLASS = c("POSIXct", 
"POSIXt"), .indexTZ = "", class = c("xts", "zoo"))

chart_Series(a,TA='add_Vo()')

你知道我该如何修复这个错误吗?或者我应该使用
chart\u系列
以外的其他工具来绘制具有大量
NA
值的
xts

您可以使用
NA.locf
此函数用最后的值填充
NA

chart_Series(na.locf(a),TA='add_Vo()')
我意识到这不是正确的答案。然后,

a_tmp<-cbind(matrix(na.locf(as.numeric(t(a[,1:4]))),ncol = 4,byrow = T),na.fill(a[,5],0))
colnames(a_tmp)<-colnames(a)
chart_Series(a_tmp,TA='add_Vo()')

a_tmp从帮助页面中,有如下注释:高度实验性(阅读:alpha)小心使用。您应该使用另一个函数并检查是否已报告此情况。
a_tmp<-cbind(matrix(na.locf(as.numeric(t(a[,1:4]))),ncol = 4,byrow = T),na.fill(a[,5],0))
colnames(a_tmp)<-colnames(a)
chart_Series(a_tmp,TA='add_Vo()')