rinstall.packagesrtools

Error installing Rtools42 in R version 4.2.2


I'm presently using R version 4.2.2 and I'm trying to install Rtools42, however I keep getting a warning that Rtools42 is not available for my version. How do I fix this?

> R.version                        
platform       x86_64-w64-mingw32               
arch           x86_64                           
os             mingw32                          
crt            ucrt                             
system         x86_64, mingw32                  
status                                          
major          4                                
minor          2.2                              
year           2022                             
month          10                               
day            31                               
svn rev        83211                            
language       R                                
version.string R version 4.2.2 (2022-10-31 ucrt)
nickname       Innocent and Trusting 
> install.packages("Rtools42")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/IMLAYT/AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘Rtools42’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

Solution

  • There are many questions and answers about Rtools not being installed and/or not being recognized by R. Most of these answers talk about some of the portions:

    But generally no answer contains this: Restart R. Some say to restart RStudio, which for most users is good enough, but not everybody runs RStudio (gasp!), and even so the need to restart it is not stated loudly enough.

    So here are some steps for dealing with Rtools not being found on Windows.

    1. Go to https://cran.r-project.org/bin/windows/Rtools/ and go to the correct version of Rtools (based on your version of R), and follow its links for downloading it and installing it. This is a windows installation, not an R package, so install it like you would another app in windows: double click the downloaded file.

    2. If you installed to a default location, then it should take care of updating the Windows PATH variable for you. If you installed to a non-standard location, then you may need to change the apparent PATH (at least for your R processes). These answers talk about various ways to work through this, though some might be outdated or not applicable to your specific problem. There are countless other StackExchange questions about updating the system PATH, don't take this as an exhaustive or even canonical approach.

    3. Restart R. If you're running in RStudio, restart RStudio as well. In fact, whatever IDE you're using may need to be restarted completely. It might even be necessary (if using a corporate computer with stricter group policies) to log out and log back in. Frankly. that last one should not be necessary in modern times, but I say it so that if restarting R and RStudio (or VScode) do not do it for you, please try logging out and back in. It doesn't sound like it should work, sometimes it does. (Just like when calling Tech Support on something, they often say "reboot" hoping to get lucky, because sometimes that fixes things.)

    4. Check Sys.which("make") to see that is should no longer be empty. From here, package installation for packages needing compiling should just work.

    The most common mistakes I've seen:

    (Community: if I'm skipping steps, feel free to suggest edits to this to fill it out. If I missed a clearly-superior answer, please either add it to this answer or let me know and we can find better ways to redirect.)