【问题标题】:Installing blotter and quantstrat on GitHub在 GitHub 上安装 blogger 和 quantstrat
【发布时间】:2017-04-25 06:05:08
【问题描述】:

我在从 Github 安装 blogger 和 quantstrat 软件包时遇到了困难。我可以在网上找到的大多数帮助都是相当过时的,当时它们托管在 sourceforge 上。我尝试使用 install_github() 函数,它在下面返回错误。 (事实上​​,当我尝试 R-Forge 时也出现了类似的错误)任何人都可以提供关于这里发生了什么的线索吗?

install_github("braverock/blotter")
Downloading GitHub repo braverock/blotter@master
from URL https://api.github.com/repos/braverock/blotter/zipball/master
Installing blotter
"C:/PROGRA~1/R/R-33~1.3/bin/x64/R" --no-site-file --no-environ --no-save  \
  --no-restore --quiet CMD INSTALL  \
  "C:/Users/User/AppData/Local/Temp/Rtmp8mMwyT/devtools416cfd229e7/braverock-blotter-bdefb02"  \
  --library="C:/Program Files/R/R-3.3.3/library" --install-tests 

* installing *source* package 'blotter' ...
** libs

*** arch - i386
c:/Rtools/mingw_32/bin/gcc  -I"C:/PROGRA~1/R/R-33~1.3/include" -DNDEBUG     -I"d:/Compiler/gcc-4.9.3/local330/include"     -O3 -Wall  -std=gnu99 -mtune=core2 -c calcPosAvgCost.c -o calcPosAvgCost.o
make: sh.exe: Command not found
make: *** [calcPosAvgCost.o] Error 127
Warning: running command 'make -f "C:/PROGRA~1/R/R-33~1.3/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-33~1.3/share/make/winshlib.mk" SHLIB="blotter.dll" OBJECTS="calcPosAvgCost.o"' had status 2
ERROR: compilation failed for package 'blotter'
* removing 'C:/Program Files/R/R-3.3.3/library/blotter'
Error: Command failed (1)

Rtools 已安装并包含在 PATH 变量中:

  • C:\RBuildTools\3.3\bin
  • C:\RBuildTools\3.3\gcc-4.6.3\bin

会话信息:

R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United Kingdom.1252 
[2] LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] devtools_1.12.0

loaded via a namespace (and not attached):
[1] httr_1.1.0    R6_2.1.2      tools_3.3.3   withr_1.0.2   curl_2.3     
[6] memoise_1.0.0 git2r_0.14.0  digest_0.6.11

【问题讨论】:

  • 你能告诉我们sh.exe在哪里吗?它看起来也像搜索 c:\Rtools 而您的 PATH 变量是 c:\RbuildTools 。这是正确的吗?
  • 它在 C:\RBuildTools\3.3\bin 中。我实际上只是安装了 Rtools 3.3 并卸载了 Rtools 3.2(作为将我的 R 版本升级到 3.3.3 的一部分),并且 c:\RbuildTools 中仍然存在一些旧的 Rtools 文件。但是我已经更改了 PATH 变量以引用新目录(并删除了旧目录)。我还需要改变什么吗?
  • 更新:在我删除了旧的 Rtools 目录后它工作了。非常感谢@riccoderks 为我指出正确的方法。对于任何可能到达这里的人,现在还需要通过 install_github("joshuaulrich/xts") 安装 xts 版本 0.10.0。

标签: r packages quantstrat


【解决方案1】:

试试这个:

install.packages("devtools")
require(devtools)
install_github("braverock/FinancialInstrument")
install_github("joshuaulrich/xts")
install_github("braverock/blotter")
install_github("braverock/quantstrat")
install_github("braverock/PerformanceAnalytics")

【讨论】:

    【解决方案2】:

    即使没有使用上述方法,我也遇到了同样的问题。它给了我错误:

    "C:/Users/dstoc/AppData/Local/Temp/RtmpiuN8Ii/file53c7224677c/blotter_0.14.7.tar.gz’ had non-zero exit status". 
    

    所以对于未来的问题:我已经从 Rstudio 手动安装了 blotter 和 quantstrat。

    1. 首先,我已按照建议安装了这些工具。

    install.packages("devtools")
    require(devtools)
    install_github("braverock/FinancialInstrument")
    install_github("joshuaulrich/xts")
    
    1. 然后,我进入了 Rstudio 的控制台 > 软件包 > 安装。在“安装自”选项中,我选择了“打包存档文件”。

    这允许您浏览您的文件。

    1. 我先搜索了blotter,然后搜索了quantstrat,并选择了tar.gz文件

    2. 成功了。不知道是不是最好的方法,但它奏效了。

    【讨论】:

    • 我已经以这种方式安装了 PerformanceAnalytics,但是选择默认位置 (C:/Users...) 不起作用(无法锁定目录..),但是我可以将它安装在 C:/R-3.6.3/library。然后在使用library('PerformanceAnalytics', lib.loc=.libPaths()[2]) 指示此特定库(通常是 .libPaths 中的第二个)的同时加载它
    猜你喜欢
    • 2020-07-23
    • 1970-01-01
    • 1970-01-01
    • 2020-05-22
    • 2020-06-05
    • 1970-01-01
    • 2020-10-29
    • 2021-02-12
    • 1970-01-01
    相关资源
    最近更新 更多