I can install any package from the R executable. But from RStudio, I get
Warning in install.packages : unable to access index for repository http://cran.rstudio.com/src/contrib: cannot open URL 'http://cran.rstudio.com/src/contrib/PACKAGES' Warning in install.packages : unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib: cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Yes, these are warnings not errors, but nothing is installed anyway.
I can change the repository e.g. with
install.packages('qgam', dependencies=TRUE, repos='http://cran.rstudio.com/')
or in the RStudio settings, but nothing makes any difference.
I have uninstalled R and Rstudio, deleted the Rstudio-desktop folder, deleted all .Renviron files, then reinstalled R and Rstudio. I have checked and unchecked "Use internet explorer library" and everything else I can find.
.libPaths() gives "C:/Users/User/Documents/R/win-library/3.4" "C:/Program Files/R/R-3.4.3/library" which seems fine, only the first is writeable to Rstudio, but that should be OK?
There are no firewalls in operation.
This is driving me nuts.
R and Rstudio are up to date, i.e. R is 3.4.3, Rstudio is 1.1.423
I posted this question on stackoverflow but no replies. https://stackoverflow.com/questions/48751027/cant-install-packages-from-any-mirror-in-rstudio-works-in-r