'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.



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Artem