Does any one know how can I get the 'quantstrat' package in R in order to work for 4.0 version?

I tried with devtools … this way…



library(devtools) # need devtools to use install_github

install_github("braverock/quantstrat")



to make 100% sure that I can get it by a github for it works in my R 4.0 version but does not work.

Hello Karen,



Can you elaborate on the error it gives you when you try to use the module? 

Hello Akshay, sure!



Above the message that shows up in the console window:



> install.packages("quantstrat")

WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:



RTools: Toolchains for building R and R packages from source on Windows

Installing package into ‘C:/Users/HP/Documents/R/win-library/4.0’

(as ‘lib’ is unspecified)

Warning in install.packages :

  package ‘quantstrat’ is not available (for R version 4.0.0)

I also tried this way:



install.packages("devtools")

library(devtools) # need devtools to use install_github

install_github("braverock/quantstrat")





but the errors that pops up are:



> install_github("braverock/quantstrat")

WARNING: Rtools is required to build R packages, but the version of Rtools previously installed in C:/rtools40 has been deleted.



Please download and install Rtools custom from RTools: Toolchains for building R and R packages from source on Windows

Downloading GitHub repo braverock/quantstrat@master

Error: Failed to install 'quantstrat' from GitHub:

  Could not find tools necessary to compile a package

Call pkgbuild::check_build_tools(debug = TRUE) to diagnose the problem.





 

Hello Karen,



To be able to help you well. I would like to know the operating system you're using. The dependency libraries to build and install for this to work will need commands of the particular package manager you use.Thanks. 

 

R has one of the best package management named CRAN. Unfortunately going to non-traditional install process can be tricky (arguably still better than Python).



I think what you are suffering from is a very misguiding error message. Do the following and you probably will be good


  1. close RStudio and install R 4.0.0 and Rtools 40 for your platform (I think you have already done it)
  2. make sure Rtools in your path (add rtools40 top directory, as well as mingw_64\bin, assuming you are on 64bit windows)
  3. make sure 'pkgbuild' is installed (else open RStudio -> Tools -> Install package and install)
  4. install "devtools" (same as above)
  5. load devtools (library(devtools) or require(devtools))
  6. install_github your packages as you do usually (for quantstart, I would do install_github("braverock/blotter"), followed by install_github("braverock/quantstrat"))



    You should be good to go. If not, open RGUI (not RStudio) and run pkgbuild::check_build_tools(debug = TRUE) and let us know the output.