1
我在使用dailyReturn
函數時遇到困難,因爲它帶有多個返回序列的xts對象。每日返回xts對象
a<-Cl(getSymbols("INTC",auto.assign=FALSE))
b<-Cl(getSymbols("IBM",auto.assign=FALSE))
a<-merge(a,b)
dailyReturn(a[,1]) #This works!
dailyReturn(a) #Only return the result for first series
apply(a,2, dailyReturn)
#Error in array(ans, c(len.a%/%d2, d.ans), if (!all(vapply(dn.ans, is.null, :
length of 'dimnames' [1] not equal to array extent
我該如何獲得dailyReturn
以返回xts對象中多個系列的每日回報?