How to Add Rtools\Bin to the System Path in R

How to set Rtools PATH for R

This is how I solved it:

  1. By looking at my PATH variable, which you get through

Sys.getenv("PATH")

I saw that it pointed rtools to c:\rtools40\. However, this should be c:\rtools40\usr\bin. I edited the environment Variable accordingly. Here is an instruction how to edit the environment variables on windows.


  1. I also added this to the .Renviron file:

PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"

The .Renviron file should be created/located accordingly to this location

Sys.getenv("HOME")

Sys.which( make ) empty although Rtools is in PATH

For posterity: the problem was that the "$" doesn't belong in the path.

Thanks to @r2evans for the solution - Sys.setenv(PATH=gsub("^\\$", "", Sys.getenv("PATH"))) did the trick.

Rtools 4.0 not found during package installation

Rtools40 requires that you add its bin directory to your PATH variable. The full instructions are here.

You can update your ~/.Renviron file with any of the following methods:

You can do that manually by opening ~/.Renviron and putting the following in it:

PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"

You can also use R (Gui or RStudio or Shell) with the following:

writeLines(
'PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"',
con = file("~/.Renviron", open = "a")
)

Both of these methods require a restart of R.

Install two versions of rtools

The problem was due to the fact that Microsoft R Client version 3.5.2, was installed in a path with space E:\Program Files\Microsoft\R Client, it was solved by installing it in a path without spaces E:\Microsoft\R-Client, such as suggested in: Message error 'C:/Program' not found with Rcpp



Related Topics



Leave a reply



Submit