I recently updated both R and R studio. I have R4.1.2 and R Studio 2021.09.2. All seemed fine until I started installing packages and R studio kept telling me things like "Warning in install.packages :
package ‘gstat_2.0-8.tar.gz’ is not available for this version of R".
While some packages installed OK, for a whole load of common packages (gstat, ggplot2, etc), it seemed impossible. Working directly directly in R there is no problem installing these packages.
I now see that "install packages works" if selected under under "tools" on the main R studio menu but it doesn't work if run from the "packages" menu, even if they produce identical looking dialogue boxes!