R: Installing Quantstrat Error

2.4k Views Asked by At

I'm trying to install quantstrat, however I always get following errors trying this:

> 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’

Sorry the error messages are German. The first error is: "There is no packages called 'iterators'" The second error is: "Package 'foreach' couldn't be loaded"

3

There are 3 best solutions below

0
On

I ran into to the same problem in order to get the install to run i had to install the quantmod package first because the rest of the packages require it pre-installed.

So first solve this dependency:

install.packages("quantmod")

then the rest of the packages

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")
0
On

Try installing from source, CRAN is not up to date and the latest fixes are only available by installing from source. I have R-3.2.1 x64, installed fine form source.

Use the following in this order from your R console or RStudio:

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")

Hope this helps.

0
On

Very late here, but perhaps relevant to note that "quantstrat" is not on CRAN, and several years ago moved to GitHub. The README on the repo (https://github.com/braverock/quantstrat) has more information for installing 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")