2

xts オブジェクトがありますclose(POSIXctインデックス付き)。quantmodコマンドを実行すると、次のエラーが発生しますspecifyModel(close[,1] ~ close[,2])

 Error in UseMethod("as.xts") : 
  no applicable method for 'as.xts' applied to an object of class "function".

                     ALBK ANDHRABANK AXISBANK BANKBARODA
2007-01-02 10:01:00 90.89      87.33   468.55     243.95
2007-01-02 10:02:00 90.80      86.92   467.75     243.70
2007-01-02 10:03:00 90.45      86.77   468.65     243.60
2007-01-02 10:04:00 90.31      86.94   468.32     243.95
2007-01-02 10:05:00 90.27      87.05   468.60     244.00
2007-01-02 10:06:00 90.23      87.00   468.00     243.65
2007-01-02 10:07:00 90.24      86.89   467.50     243.60
2007-01-02 10:08:00 89.99      86.77   467.05     243.00
2007-01-02 10:09:00 90.05      86.80   467.40     243.00
2007-01-02 10:10:00 90.20      87.00   467.00     243.00

このエラーの意味と修正方法を教えてください。

4

1 に答える 1

2

closeベースR関数の名前であるため、混乱しています。(おそらくバグですが、どれだけ広く使用されているかはわかりませんspecifyModel)

> close <- getSymbols("SPY", src="yahoo", auto.assign=FALSE)
> specifyModel(close[, 1] ~ close[, 2])
Error in UseMethod("as.xts") : 
  no applicable method for 'as.xts' applied to an object of class "function"

xts オブジェクトの名前を変更して修正します

> dat <- close
> specifyModel(dat[, 1] ~ dat[, 2])

quantmod object:        Build date:   

Model Specified: 
     dat[, 1] ~ dat[, 2] 

Model Target:  [ dat 0.1         Product:  dat 
Model Inputs:   

Fitted Model: 

    None Fitted
> 
于 2013-01-18T17:49:31.497 に答える