How do I configure Rtools40 in Windows 10 with R 4.0.0?

I recently installed R 4.0.0. Along with it, I also installed Rtools40. The CRAN website said I also need to specify path for Rtools make file in the .Renviron file. But when I created the .Renviron file, I cannot use stats package. If .Renviron file exists, it gives error that some shared dll file is missing. And if I delete the .Renviron file, this error goes away, but I cannot compile packages using Rtools40. How can I configure this .Renviron file so that I can also use both - Rtools40 and stats package? My Rtools make file is in C:/(MyUserName)/Rtools40/usr/bin folder. This same folder also contains the bash file, which came with Rtools40.


Solution 1:

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

I had the same problem. I was following the Rtools40 download instructions, and instead of adding Rtools to the beginning of the path, adding it to the end fixed it.