Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
307 views
in Technique[技术] by (71.8m points)

shiny - How to add Rtoolsin to the system path in R

Am running a Shiny app from https://github.com/MikeJSeo/SAM and the code to access it:

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

The app runs great but I get a error when trying to save the output. This is the error I obtain:

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

I tried;

Sys.getenv("PATH")

and the output is

[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"

Am assuming that my error arrises because I dont have the "Rtoolsin" directory. I have tried,

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

but not luck. So how can I go about correcting this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This fixed my problem.

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...