This is how I solved it:
- By looking at my
PATHvariable, 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.
- I also added this to the
.Renvironfile:
PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"
The .Renviron file should be created/located accordingly to this location
Sys.getenv("HOME")
Answer from four-eyes on Stack OverflowVideos
This is how I solved it:
- By looking at my
PATHvariable, 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.
- I also added this to the
.Renvironfile:
PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"
The .Renviron file should be created/located accordingly to this location
Sys.getenv("HOME")
I had a similar problem. My workaround: Upon checking Sys.getenv("PATH") I found that I had a different verison of rtools (42 instead of 43 as listed there). I uninstalled the wrong version and downloaded rtools43. Now it works.
This fixed my problem.
Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))
Sys.setenv(BINPREF = "C:/Rtools/mingw_$(WIN)/bin/")
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").