[R] Problem with R-2.1.0: install.packages() doesn't work

Marc Schwartz MSchwartz at MedAnalytics.com
Sat Apr 23 00:33:47 CEST 2005


On Fri, 2005-04-22 at 18:00 -0400, Manuel Morales wrote:
> On Fri, 2005-04-22 at 15:42 -0500, Marc Schwartz wrote:
> > On Fri, 2005-04-22 at 15:44 -0400, Manuel Morales wrote:
> > > On Fri, 2005-04-22 at 17:48 +0200, Uwe Ligges wrote:
> > > > Waichler, Scott R wrote:
> > > > 
> > > > > I installed R-2.1.0 from source on a Linux box running Red Hat
> > > > > Enterprise Linux WS release 4 but install.packages() wouldn't work (see
> > > > > below).
> > > 
> > > > >>install.packages("rgenoud")
> > > > > 
> > > > > --- Please select a CRAN mirror for use in this session ---
> > > > > Error in inherits(x, "factor") : Object "res" not found
> > > > 
> > > > 
> > > > Quite probably you have no X11 connection to this machine.
> > > > R tries to ask you which CRAN mirror you are going to choose, and it 
> > > > fails to present the tcltk window.
> > > > You might want to call
> > > >    chooseCRANmirror(graphics=FALSE)
> > > > and
> > > >    setRepositories(graphics=FALSE)
> > > > prior to install.packages().
> > > > 
> > > > Uwe Ligges
> > > > 
> > > 
> > > I have the same problem after building R-2.1.0 from source on Fedora
> > > Core 3. The suggestion above fixes this, but what do you mean by "Quite
> > > probably you have no X11 connection on this machine"? I'm guessing you
> > > don't mean that X11 is not "running" (I use Gnome for my desktop).
> > > 
> > > Manuel
> > 
> > 
> > For both Scott and Manuel,
> > 
> > Can you post back with the output of:
> > 
> > > capabilities()
> > 
> 
> This is what I got:
> > capabilities()
>     jpeg      png    tcltk      X11 http/ftp  sockets   libxml     fifo
>     TRUE     TRUE    FALSE     TRUE     TRUE     TRUE     TRUE     TRUE
>   cledit  IEEE754    iconv
>     TRUE     TRUE     TRUE
> 
> I recompiled after downloading the tc and tk development packages, which
> gave tcltk as TRUE. update.packages() works if tcltk is enabled, but it
> seems not to revert to the non-graphical interface otherwise...


Ok. So that suggests a problem with capabilities(tcltk) == FALSE, which
will be the result of not having the tcl/tk devel RPMS installed.

To Peter's prior post, my read of the code for menu() suggests that
there is a problem in the conditional code:

> menu
function (choices, graphics = FALSE, title = "")
...

The code check there is:

    if (graphics) {
        if (.Platform$OS.type == "windows" || .Platform$GUI ==
            "AQUA") {
            res <- select.list(choices, multiple = FALSE, title = title)
            return(match(res, choices, nomatch = 0))
        }
        else if (.Platform$OS.type == "unix" && capabilities("tcltk") &&
            capabilities("X11"))
            res <- tcltk::tk_select.list(choices, multiple = FALSE,
                title = title)
        return(match(res, choices, nomatch = 0))
    }


If my read is correct, it looks like there might be a missing brace pair
for the 'else if' part?

Shouldn't that section read:

   if (graphics) {
        if (.Platform$OS.type == "windows" || .Platform$GUI ==
            "AQUA") {
            res <- select.list(choices, multiple = FALSE, title = title)
            return(match(res, choices, nomatch = 0))
        }
        else if (.Platform$OS.type == "unix" && capabilities("tcltk") &&
            capabilities("X11")) { # <<<<<< NOTE OPEN BRACE HERE >>>>>>
            res <- tcltk::tk_select.list(choices, multiple = FALSE,
                title = title)
            return(match(res, choices, nomatch = 0))
        } # <<<<<< NOTE CLOSE BRACE HERE >>>>>
    }


Without the braces, it will get to:

 return(match(res, choices, nomatch = 0))

whether all of the checks are TRUE or not, the latter being the case at
least for Manuel.


HTH,

Marc Schwartz




More information about the R-help mailing list