[R] Setting two default CRAN servers under Windows/RStudio

Sigbert Klinke sigbert at wiwi.hu-berlin.de
Fri Jun 19 14:14:11 CEST 2015


Hi,

we are running in our network a non-public CRAN mirror. I got it working
with the entry in "Rprofile.site"

local({r <- getOption("repos")
       r["CRAN"] <- "http://local.cran.server"
       options(repos=r)
})

In case that our CRAN mirror does not work we want to send the R/RStudio
users to a public server. I tried

1.
local({r <- getOption("repos")
       r["CRAN"] <- c("CRAN"="http://local.cran.server", r)
       options(repos=r)
})

-> install.packages offered the list of public mirrors

2.
local({r <- getOption("repos")
       r["CRAN"] <- c(r, "CRAN"="http://local.cran.server")
       options(repos=r)
})

-> packages are taken from cran.rstudio.com

3.
local({r <- getOption("repos")
       r["CRAN"] <- c(r["CRAN"], "CRAN"="http://local.cran.server",
r["CRANextra"])
       options(repos=r)
})

-> packages are taken from cran.rstudio.com

None of the solutions worked under RStudio, the packages are always
installed from the public servers. Any ideas?

Thanks Sigbert


More information about the R-help mailing list