【问题标题】:How to add Rtools\bin to the system path in R如何将 Rtools\bin 添加到 R 中的系统路径
【发布时间】:2018-05-12 08:32:25
【问题描述】:

我正在运行来自 https://github.com/MikeJSeo/SAM 的 Shiny 应用程序 以及访问它的代码:

install.packages(c("samr", "matrixStats", "GSA", "shiny", "openxlsx"))
source("http://bioconductor.org/biocLite.R")
biocLite("impute")
library(shiny)
runGitHub("SAM", "MikeJSeo")

应用程序运行良好,但在尝试保存输出时出现错误。这是我得到的错误:

Warning: Error in : zipping up workbook failed. Please make sure Rtools is installed or a zip application is available to R.
Try installr::install.rtools() on Windows. If the "Rtools\bin" directory does not appear in Sys.getenv("PATH") please add it to the system PATH 
or set this within the R session with Sys.setenv("R_ZIPCMD" = "path/to/zip.exe")

我试过了;

Sys.getenv("PATH")

输出是

[1] "C:\\Program Files\\R\\R-3.4.1\\bin\\x64;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\ActivIdentity\\ActivClient\\;C:\\Program Files (x86)\\ActivIdentity\\ActivClient\\;C:\\Program Files (x86)\\Addinsoft\\XLSTAT\\;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\"

我假设我的错误出现是因为我没有“Rtools\bin”目录。我试过了,

Sys.setenv("R_ZIPCMD" = "mypath/to/zip.exe")

但不是运气。那么我该如何纠正呢?

【问题讨论】:

    标签: r shiny


    【解决方案1】:

    这解决了我的问题。

    library(devtools)
    Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))
    Sys.setenv(BINPREF = "C:/Rtools/mingw_$(WIN)/bin/")
    

    【讨论】:

    • 我也有类似的问题。但是每次在我的 nem PC 中打开 RStudio 时,我都需要将 Rtools 设置为系统路径。关于如何解决这个问题的任何想法?
    【解决方案2】:

    要回答 John Doe 的问题,您可以通过将此行添加到您的 .Rprofile 来确保 Rtools 始终位于路径中且仅适用于 R:

    Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))
    

    .Rprofile 需要位于命令Sys.getenv("HOME") 指向的路径。

    【讨论】:

      猜你喜欢
      • 2011-08-09
      • 1970-01-01
      • 2019-02-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-01
      • 1970-01-01
      • 2011-03-26
      相关资源
      最近更新 更多