当我调用periodReturns函数时,我从Xts包中收到以下错误。我已经从github升级了Quantmod和Xts包但仍然存在错误。 任何人都可以建议如何解决这个问题?
谢谢,
getSymbols('AAPL', src = 'yahoo', from = '2016-01-01', auto.assign = T)
> periodReturn(AAPL,by=years,from='2003-01-01')
Error in lag.xts(x1, K.) :
INTEGER() can only be applied to a 'integer', not a 'double'
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8.1 x64 (build 9600)
Matrix products: default
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 LC_MONETARY=English_Australia.1252
[4] LC_NUMERIC=C LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] PerformanceAnalytics_1.5.1 quantmod_0.4-9 TTR_0.23-1 xts_0.10-0
[5] zoo_1.8-0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.10 lattice_0.20-35 codetools_0.2-15 IKTrading_1.0
[5] foreach_1.4.4 grid_3.4.0 curl_2.6 boot_1.3-19
[9] blotter_0.11.3 iterators_1.0.8 FinancialInstrument_1.2.0 compiler_3.4.0
[13] quantstrat_0.10.0
答案 0 :(得分:0)
我无法重现您的错误。虽然您正在下载数据<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="400dp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- Content here -->
</LinearLayout>
</ScrollView>
</LinearLayout>
并计算返回from = '2016-01-01'
,但您的代码仍然适用于我。也许你可以尝试修复它并看到它?
from='2003-01-01'