R 4.0 install Rtools, solve warning: Rtools is required to build R packages but is not currently installed
STEP 1 DOWNLOAD RTOOLS
Download link: https://cran.r-project.org/bin/windows/Rtools/rtools40.html
STEP 2 INSTALL RTOOLS
Just click all steps as default
STEP 3 CONFIGURE PATH
There are 2 ways to do it, I only use the first one then solve the problem. If you can't solve problem by using first option, then use the second.
OPTION 1
Open RStudio, and run code as follow:
writeLines('PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"', con = "~/.Renviron")
If there is no error messenge appeared, then close and open Rstudio again.
Once there is error messenge, jump to OPTION 2
OPTION 2
open a text editor, copy PATH="${RTOOLS40_HOME}\usr\bin;${PATH}" into and save file under RStudio's working directory.
To get working directory: Run getwd() in Rstudio
Then change file name to .Renviron
(don't leave .txt at the end)
If error popup like: you have to name a file name, then do as follow:
change file name to a.txt
open Windows Powershell by shift + right click file directory
run code: ren a.txt .Renviron
if there is no error appeared, then open file and double check if code was correct
CONFIGURE CONT...
Once close and open Rstudio again, run code to check if configuration has been correctly set.
Sys.which("make")
If there is messenge like: "C:\rtools40\usr\bin\make.exe" then you have configur rtools succesffuly
Ref
https://blog.csdn.net/weixin_42098685/article/details/105864543 ttps://cran.r-project.org/bin/windows/Rtools/












