正在运行来自 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")
但不是运气。那么我该如何纠正这个问题呢?
最佳答案
这解决了我的问题。
library(devtools)
Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))
Sys.setenv(BINPREF = "C:/Rtools/mingw_$(WIN)/bin/")
关于r - 如何将Rtools\bin添加到R中的系统路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47539125/