Setting two default CRAN servers under Windows/RStudio

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting two default CRAN servers under Windows/RStudio

Sigbert Klinke
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
______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Setting two default CRAN servers under Windows/RStudio

Duncan Murdoch-2
On 19/06/2015 8:14 AM, Sigbert Klinke wrote:

> 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?

Your options seem to be trying to put a length two vector into a single
entry.  Just create a vector like

r <- c(localCRAN = "http://local.cran.server", r)

and you'll get a length two vector instead.

Duncan Murdoch

Duncan Murdoch

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Setting two default CRAN servers under Windows/RStudio

Thierry Onkelinx
In reply to this post by Sigbert Klinke
We have this in our Rprofile.site This works fine. It checks each mirror
and installs (or updates) the latest version available on all mirrors. e.g.
abc 0.1 on RStudio and abc 0.2 on RForge, then abc 0.2 from RForge gets
installed/updated.

options(
  repos = c(
    RStudio = "http://cran.rstudio.com/",
    RForge = "http://r-forge.r-project.org",
    Belgium = "http://www.freestatistics.org/cran/",
    CRAN = "http://cran.at.r-project.org/",
    Oxford = "http://www.stats.ox.ac.uk/pub/RWin"
  ),
  install.packages.check.source = "no"
)

Best regards,

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

2015-06-19 14:14 GMT+02:00 Sigbert Klinke <[hidden email]>:

> 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
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Setting two default CRAN servers under Windows/RStudio

Sigbert Klinke
Hi,

I tried the following:

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

But: R seems always to take the "CRAN" entry first, therefore I put our
local mirror there.

If a R session starts and the "CRAN" server is not available then a
package is taken from the "MIRROR" server. If the server comes up during
the session then the next install.packages will use the "CRAN" server.

But if the "CRAN" server becomes unavailable during a session then the
"MIRROR" server is not checked and I get an error message "download of
package 'xyz' failed".

Any ideas?

Sigbert

Am 19.06.2015 um 15:32 schrieb Thierry Onkelinx:

> We have this in our Rprofile.site This works fine. It checks each mirror
> and installs (or updates) the latest version available on all mirrors. e.g.
> abc 0.1 on RStudio and abc 0.2 on RForge, then abc 0.2 from RForge gets
> installed/updated.
>
> options(
>   repos = c(
>     RStudio = "http://cran.rstudio.com/",
>     RForge = "http://r-forge.r-project.org",
>     Belgium = "http://www.freestatistics.org/cran/",
>     CRAN = "http://cran.at.r-project.org/",
>     Oxford = "http://www.stats.ox.ac.uk/pub/RWin"
>   ),
>   install.packages.check.source = "no"
> )


--
http://u.hu-berlin.de/sk

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.