這可能是一個潛在的錯誤,我很難用一個獨立的例子來重現它,但是,也許錯誤信息可能有助於挖掘它的底部。 miv
是data.table
:na.omit in data.table,R
> str(miv)
Classes ‘data.table’ and 'data.frame': 113534 obs. of 21 variables:
$ ym : num 1980 1980 1980 1980 1980 ...
$ dte : Date, format: "1980-03-31" "1980-03-31" ...
$ xs_ret : num -16.3 -16.3 -16.3 14.3 14.3 ...
$ xs_mkt : num -8.85 -8.85 -8.85 12.77 12.77 ...
$ smb : num -7.23 -7.23 -7.23 3.62 3.62 ...
$ hml : num 0.966 0.966 0.966 0.318 0.318 ...
$ umd : num 3.713 3.713 3.713 -0.762 -0.762 ...
$ wficn : num 100567 101394 102565 100010 100019 ...
$ iv_w : num [1:113534, 1] -1.039 -0.571 -0.831 -0.357 -0.263 ...
> miv <- na.omit(miv)
Error in `[.data.table`(object, !omit) :
i is invalid type (matrix). Perhaps in future a 2 column matrix could return a list of elements of DT (in the spirit of A[B] in FAQ 2.14). Please let datatable-help know if you'd like this, or add your comments to FR #1611.
你能至少說明你是如何創建的'iv_w'列? – GSee
不幸的是,有大約100行代碼創建該列 – Alex