Issues installing Rtools package
r - Rtools is not being detected from RStudio - Stack Overflow
RStudio do not find Rtools and offer to install even if already installed
How to point RStudio out to RTOOLS 4.4 ?
Videos
I have Rstudio 2023.12.1 build 402.
I initially tried installing the Rtools package & got the following error:
install.packages("Rtools") WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
I went to the below site & downloaded the Rtools43 installer, and am still getting the same error when i try running install.packages("Rtools") or install.packages("Rtools43").
https://cran.r-project.org/bin/windows/Rtools/rtools43/rtools.html
Does anyone know what I'm doing wrong?
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/")
Ensure that for the BINPREF path, the final slash is included after 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/
Note that there are new potential kinds of problems (from R 3.3 onwards), since R (not RStudio, but R) adds a BINPREF variable and modifies the Path variable by default, see the Renviron.site file for the latter, on Windows typically e.g. under C:\Program Files\R\R-3.4.3\etc:
PATH="C:\Rtools\bin;${PATH}"
This might easily conflict for people with a custom path and/or multiple versions of Rtools installed, so I have commented this out with a #.
For the BINPREF problem, see the Makeconf file, e.g. under C:\Program Files\R\R-3.4.3\etc\x64:
BINPREF ?= c:/Rtools/mingw_64/bin/
I have then modified this to c:/Rtools34/mingw_64/bin/, which is where I have installed my Rtools34.
You can do the same for the Makeconf file under the 32-bit arch. sub-directory.