如何将Rtoolsin添加到R中的系统路径 [英] How to add Rtoolsin to the system path in R

查看:6
本文介绍了如何将Rtoolsin添加到R中的系统路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从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 "Rtoolsin" 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\"
我假设我的错误是因为我没有"Rtoolsin"目录而出现的。我试过了,

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/")

这篇关于如何将Rtoolsin添加到R中的系统路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆