正在运行来自 https://github.com/MikeJSeo/SAM 的闪亮应用程序 以及访问它的代码:
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 in”目录。我试过了,
Sys.setenv("R_ZIPCMD" = "mypath/to/zip.exe")
但不是运气。那么我该如何纠正这个问题呢?
这解决了我的问题。
Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))
Sys.setenv(BINPREF = "C:/Rtools/mingw_$(WIN)/bin/")
要回答 John Doe 的问题,您可以通过将此行添加到您的
.Rprofile
: 来确保 Rtools 始终位于且仅适用于 R 的路径中
Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))
.Rprofile
需要位于命令Sys.getenv("HOME")
所指向的路径。