[rkward-devel] Provide a UI for CRAN mirrors

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Thu Nov 26 13:54:36 UTC 2009


Hi,

On Thursday 26 November 2009, Prasenjit Kapat wrote:
> This has been a very long standing itch of mine - to get rid of the
> ugly (and very minimally informative) Tcl/Tk box to choose the CRAN
> mirrors (one that pops up during install.packages or update.packages
> or ...). Basically, to set options(repos=c(CRAN=....)) with an actual
> url instead of '@CRAN@'.
> 
> I've added a combobox (see attached image). But there is a bug:
> 
> Every time rkward is started, the repos url is set to "" (empty). Once
> you go to Settings > R-packages  and set a 'CRAN download mirror' and
> click apply, only then the repos url is set properly.

I have not done any testing, yet. I believe the bug is that you save the index 
position of the list. When loading the settings, this is not resolved to the 
corresponding url, so you get an empty string, instead. I think the best 
solution is to simply store the url in the config. This is also less error-
prone if / when the list changes one day.

Another thing: Are you aware of getCRANmirrors()? I guess it does most of what 
you do in CRAN_mirror_list.R in a way that is less likely to break in the 
future.

On a more general note: I don't like the hard-coding involved, and would 
rather like to see a more generic solution. If the main issue is the Tcl/Tk 
dialog, we could (and should) get rid of that in general by overriding menu().

Steps involved in that approach:
1) Change menu() so that if "graphics" is TRUE, something like
      .rk.do.call ("menu", c (choices, title))
will be called. The default behavior otherwise. NOTE: Need to use 
assignInNamespace() to override the menu function in the utils namespace.
2) The call would be implemented in RInterface::processREvalRequest() (where 
there are many examples of the basic idea).

Of course this does not store the mirror-setting permanently, so you would 
still be prompted for a mirror each session. But it would be with a "nice" 
dialog instead of the tcl/tk one. Want to give that a try?

Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20091126/34bb5f39/attachment.sig>


More information about the Rkward-devel mailing list