[英]How to add Rtools\bin to the system path in R
我从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/")
要回答John Doe的问题,您可以通过将此行添加到.Rprofile
来确保Rtools始终位于路径中且仅适用于R:
Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))
.Rprofile
需要位于命令Sys.getenv("HOME")
指向的路径上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.