简体   繁体   English

Rtools 带 R 便携

[英]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.我将 R 的便携式版本用于我没有管理员权限的计算机中的项目。 I use zip function to encrypt & zip a folder.我使用 zip function 来加密 & zip 一个文件夹。 Apparently computer doesn't have Rtools and I cannot install it.显然计算机没有 Rtools,我无法安装它。 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.我想知道我如何指向 R 查看我有 Rtools 可用的本地文件夹(with../bin/zip.exe) 我试图在 Rprofile.site 中添加Sys.setenv(zip="folderpath_of_Rtools/bin"但它不起作用。

The answer was posted by OP in a question body.答案由 OP 在问题正文中发布。 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 = ""))
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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