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

Marc Schwartz MSchwartz at MedAnalytics.com
Sat Apr 23 06:14:44 CEST 2005


Hi all,

In follow up to my message earlier, I spent some time applying the
modification to the menu() function that I referenced earlier. I also
recompiled a local copy of R on my FC3 system using:

./configure --without-tcltk

This results in:

> capabilities()
    jpeg      png    tcltk      X11 http/ftp  sockets   libxml     fifo
    TRUE     TRUE    FALSE     TRUE     TRUE     TRUE     TRUE     TRUE
  cledit  IEEE754    iconv
    TRUE     TRUE     TRUE


The first time around, I ran the menu() function unchanged and got the
same error that Scott and Manuel reported earlier:

Error in inherits(x, "factor") : Object "res" not found

'res' is the value returned from the tcltk function tk.select.list()
used in menu().

This appeared for the series of functions that call menu(), such as
update.packages(), install.packages(), chooseCRANmirror(), contrib.url
(), etc.

After modifying the menu function, I was able to get:

> install.packages("rgenoud")
--- Please select a CRAN mirror for use in this session ---
CRAN mirror

 1: Australia               2: Austria
 3: Brasil (PR)             4: Brasil (MG)
 5: Brasil (SP 1)           6: Brasil (SP 2)
 7: Canada (BC)             8: Canada (ON)
 9: Denmark                10: France (Toulouse)
11: France (Lyon)          12: France (Paris)
13: Germany (Berlin)       14: Germany (Koeln)
15: Germany (Mainz)        16: Germany (Muenchen)
17: Hungary                18: Italy (Arezzo)
19: Italy (Ferrara)        20: Japan (Aizu)
21: Japan (Tsukuba)        22: Poland
23: Portugal               24: Slovenia (Besnica)
25: Slovenia (Ljubljana)   26: South Africa
27: Spain                  28: Switzerland (Zuerich)
29: Switzerland (Bern 1)   30: Switzerland (Bern 2)
31: Turkey                 32: Taiwan
33: UK (Bristol)           34: UK (London)
35: USA (CA 1)             36: USA (CA 2)
37: USA (MA)               38: USA (MI)
39: USA (NC)               40: USA (PA 1)
41: USA (PA 2)             42: USA (WA)


Selection:


So, with the modification in menu() and without tcltk available, the
text menu now comes up properly.

The proposed patch for .../src/library/utils/menu.R is attached.

HTH,

Marc Schwartz

-------------- next part --------------
--- R-2.1.0/src/library/utils/R/menu.R	2005-04-18 05:18:57.000000000 -0500
+++ R-2.1.0-patch/src/library/utils/R/menu.R	2005-04-22 22:08:23.000000000 -0500
@@ -6,9 +6,10 @@
             res <- select.list(choices, multiple=FALSE, title=title)
             return(match(res, choices, nomatch = 0))
         } else if(.Platform$OS.type == "unix"
-                && capabilities("tcltk") && capabilities("X11"))
+                && capabilities("tcltk") && capabilities("X11")) {
             res <- tcltk::tk_select.list(choices, multiple=FALSE, title=title)
             return(match(res, choices, nomatch = 0))
+        }    
     }
     nc <- length(choices)
     if(length(title) && nchar(title[1])) cat(title[1], "\n")


More information about the R-help mailing list