我正在尝试安装quantstrat,但是在尝试此操作时我总是遇到以下错误:
> install.packages("quantstrat",repos="http://R-Forge.R-project.org")
Warning in install.packages :
package ‘quantstrat’ is not available (for R version 3.0.1)
Installing package into ‘C:/Users/mp/Documents/R/win-library/3.0’
(as ‘lib’ is unspecified)
trying URL 'http://R-Forge.R-project.org/bin/windows/contrib/3.0/quantstrat_0.7.8.zip'
Content type 'application/zip' length 1047389 bytes (1022 Kb)
opened URL
downloaded 1022 Kb
package ‘quantstrat’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\TEMP\Rtmp8uoKKX\downloaded_packages
> require(quantstrat)
Lade nötiges Paket: quantstrat
Lade nötiges Paket: foreach
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
es gibt kein Paket namens ‘iterators’
Failed with error: ‘Paket ‘foreach’ konnte nicht geladen werden’
抱歉,错误消息是德语。第一个错误是:“没有名为'iterators'的包 第二个错误是:“无法加载包'foreach'”
答案 0 :(得分:1)
我遇到了同样的问题 为了使安装运行,我必须首先安装quantmod包,因为其余的包需要预先安装。
首先解决这种依赖:
install.packages("quantmod")
然后是其他软件包
install.packages("FinancialInstrument", repos="http://R-Forge.R-project.org")
install.packages("blotter", repos="http://R-Forge.R-project.org")
install.packages("quantstrat", repos="http://R-Forge.R-project.org")
答案 1 :(得分:0)
在这里很晚,但是可能需要注意的是,“ quantstrat”不在CRAN上,几年前移至GitHub。存储库(https://github.com/braverock/quantstrat)上的自述文件提供了有关安装Quantstrat的更多信息。
install.packages("devtools") # if not installed
install.packages("FinancialInstrument") #if not installed
install.packages("PerformanceAnalytics") #if not installed
# next install blotter from GitHub
devtools::install_github("braverock/blotter")
# next install quantstrat from GitHub
devtools::install_github("braverock/quantstrat")