I have no idea why RStudio has such kind of problems from time to time but there is a manual work-around described here:
https://github.com/rwinlib/r-base/wiki/Testing-Packages-with-Experimental-R-Devel-Build-for-Windows
Basically you have to set two environment variables to point to the correct installation path of Rtools:
Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))
Sys.setenv(BINPREF = "C:/Rtools/mingw_$(WIN)/bin/")
To avoid losing this change after restarting RStudio you could modify your (Windows) environment variables instead or add the following rows to your .Renviron
file that is executed at each startup of R.
BTW: The $(WIN)
part is no typo but required so that R can inject “32” or “64” depending on the R version you are using (32 or 64 bit).
Edit 1: See also this r-bloggers article published recently: https://www.r-bloggers.com/quirks-about-running-rcpp-on-windows-through-rstudio/