From ripley at stats.ox.ac.uk  Thu Jan  7 14:35:43 2010
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Thu, 7 Jan 2010 13:35:43 +0000 (GMT)
Subject: [Rd] chooseCRANmirror() (PR#14179)
In-Reply-To: <20100106201010.2D5D0282BE89@mail.pubhealth.ku.dk>
References: <20100106201010.2D5D0282BE89@mail.pubhealth.ku.dk>
Message-ID: <alpine.LFD.2.00.1001071332390.20751@gannet.stats.ox.ac.uk>

Hmm, have you read getCRANmirrors?  It works gracefully if the 
connection is down, and has been tested quite a lot ....

It seems you got a corrupt read from the URL: that's not reproducible 
and the place to deal with that is getCRANmirrors.

Please do use an informative subject line: it makes things *much* 
easier to find in archives.


On Wed, 6 Jan 2010, chrishold at psyctc.org wrote:

> Full_Name: Chris Evans
> Version: 2.10.1
> OS: Windows XP sp3
> Submission from: (NULL) (86.159.235.204)
>
>
> I was on leave and using a wifi internet connection in France and got connected,
> launched R (2.10.1 on Windoze XPsp3) and tried to update my packages and got:
>
>> chooseCRANmirror()
> Error in m[, 1L] : incorrect number of dimensions
>
> It took me a bit to realise that the message was coming up because the wifi
> connection had dropped.  I know it's a small issue but is it possible to produce
> a more informative error message. I can see a bodge of changing chooseCRANmirror
> to:
>
> function (graphics = getOption("menu.graphics"))
> {
>    if (!interactive())
>        stop("cannot choose a CRAN mirror non-interactively")
>    m <- getCRANmirrors(all = FALSE, local.only = FALSE)
>    ### bodge added here
>    if (ncol(m) != 8) stop("There was a problem with access to CRAN mirrors,
> please check your internet connection")
>    ### end of bodge
>    res <- menu(m[, 1L], graphics, "CRAN mirror")
>    if (res > 0L) {
>        URL <- m[res, "URL"]
>        repos <- getOption("repos")
>        repos["CRAN"] <- gsub("/$", "", URL[1L])
>        options(repos = repos)
>    }
>    invisible()
> }
> <environment: namespace:utils>
>
> However, I'm sure you code gurus can do much better than that.
>
> Many thanks for R: statistical wonderland, coding genius and a social movement
> of which to be hugely proud!
>
> Chris (Evans)
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] chooseCRANmirror() (PR#14179)
Prof Brian Ripley