简体   繁体   中英

Rtools with R portable

Hello Fellow enthusiasts,

I use portable version of R for a project in a computer where I have no administrator privilege. I use zip function to encrypt & zip a folder. Apparently computer doesn't have Rtools and I cannot install it. I am wondering how I can point R to look into a local folder where I have Rtools available (with../bin/zip.exe) I have tried to add Sys.setenv(zip="folderpath_of_Rtools/bin" in Rprofile.site But it is not working.

The answer was posted by OP in a question body. Transfered to separate answer.

After a reboot, the following code works:

Rtools.bin="C:\\Users\\User_2\\R-Portable\\Rtools\\bin"
sys.path = Sys.getenv("PATH")
if (Sys.which("zip") == "" ) {
    system(paste("setx PATH \"", Rtools.bin, ";", sys.path, "\"", sep = ""))
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM