[R] message: please select CRAN mirror

Ben Bolker bbolker at gmail.com
Wed Mar 2 20:05:05 CET 2011


Aggita <a.strelniece <at> eurotransplant.org> writes:

> 
> > chooseCRANmirror()
> Error in m[, 1L] : incorrect number of dimensions
> 
> Can someone explain me why I can't choose the cran mirror, but get again and
> again this error message. Have searched for this on several engines but
> can't find explanation.
> 

  It's hard for us to diagnose this if we can't reproduce it.
  I will take a shot though.

  The chooseCRANmirror function looks like this:

function (graphics = getOption("menu.graphics")) 
{
    if (!interactive()) 
        stop("cannot choose a CRAN mirror non-interactively")
    m <- getCRANmirrors(all = FALSE, local.only = FALSE)
    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()
}

   Looking in the guts of the function, it is clear that
it is failing when it looks at the list of mirrors that
it has gotten -- this list of mirrors has somehow turned
into a vector instead of a matrix.
   You could use debug(chooseCRANmirror) to step through the
function and inspect the value of m just before the function
crashes.
   This is probably the result of some sort of network problem --
you're not getting a decent list of mirrors.  What is the
result of

str(getCRANmirrors(all=FALSE,local.only=FALSE))

  ?



More information about the R-help mailing list