It is not clear from the documentation what is the behavior if multiple repos are specified at install.packages. My intuition told me that it would try the first repo, and if the package is not found, it would try the second, and so on. Unfortunately it does not appear to be the case. What I see is that only the first is tried, and an error is returned (because the repo does not contain the package). There's also lack of clarity of how the "CRAN" entry is handled compared to a different entry.
What I want to have is a local CRAN with my own packages (specified first), and the global CRAN with the larger package sets (specified second), and be able to install from the local unless the package is not found (and in that case, it will fall back to the global)
Here is the error I get
> setRepositories(graphics = FALSE, ind=NULL, addURLs=c(ciccio="file:qs-cran", CRAN="https://mran.microsoft.com/snapshot/2018-08-01"))
> install.packages("zizzio")
Error in read.dcf(file = tmpf) : cannot open the connection
In addition: Warning messages:
1: package ‘zizzio’ is not available (for R version 3.5.3)
2: In read.dcf(file = tmpf) :
cannot open compressed file 'qs-cran/bin/macosx/el-capitan/contrib/3.5/PACKAGES', probable reason 'No such file or directory'
> install.packages("zizzio", type="source")
Warning message:
package ‘zizzio’ is not available (for R version 3.5.3)