I have a new computer in the same network as the old one. In the new one, I first installed RStudio, then the latest version of R (I hope the order does not matter). Now, the new R installation gets "unable to access index for repository" error for every library. Simple task becomes hours of googling, during which I tried the following:
- tick or untick use secure download method for http in global options (was ticked in the old computer)
- try different, close my location repositories in global settings
- copy the folder of an existing package (like ggplot2) from the old computer to the new one's library folder (does not become visible in packages pane)
- uninstall and reinstall R
- compare installations (the only difference is that in the old computer, folder RTools is under c:/program files while in the new one I accepted the standard location and folder (c:/Rtools40)
Please note that both computers are in the same corporate network, so the firewall and other network settings are the same.
Finally I found the reason: our company uses an internal repository that mirrors an external one. After inserting a custom repository, everything worked perfectly.
I hope this helps if someone runs to a similar problem.
Thanks everyone for your comments!