12

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

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 "Rtools\bin" directory. I have tried,

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

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

2 Answers 2

21

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/")
1
  • 2
    I have a similar problem. But I keep needing to set Rtools to the system path everytime I open RStudio in my nem PC. Any idea on how to fix this problem?
    – John Doe
    Aug 12, 2018 at 16:49
10

To answer to John Doe's question, you can make sure that Rtools is in the path always and only for R by adding this line to your .Rprofile:

Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))

.Rprofile needs to be located at the path pointed by the command Sys.getenv("HOME").

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.