[R] [R-pkgs] formatR: farewell to ugly R code... Problem with too old ver. of Gtk

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Apr 18 14:25:35 CEST 2010


On Sun, 18 Apr 2010, Brian Lunergan wrote:

> Yihui Xie wrote:
>> This is an announcement of the release of an R package 'formatR',
>> which can help us format our R code to make it more human-readable. If
>> you have ugly (I mean unformatted) R code like this:
>>
>>  # rotation of the word "Animation"
>> # in a loop; change the angle and color
>> # step by step
>> for (i in 1:360) {
>>      # redraw the plot again and again
>> plot(1,ann=FALSE,type="n",axes=FALSE)
>> # rotate; use rainbow() colors
>> text(1,1,"Animation",srt=i,col=rainbow(360)[i],cex=7*i/360)
>> # pause for a while
>> Sys.sleep(0.01)}
>>
>> There are no spaces, no appropriate indent... The package 'formatR'
>> provides a GUI (by gWidgets) to make messy R code clean and tidy, e.g.
>>
>> # rotation of the word 'Animation'
>> # in a loop; change the angle and color
>> # step by step
>> for (i in 1:360) {
>>    # redraw the plot again and again
>>    plot(1, ann = FALSE, type = "n", axes = FALSE)
>>    # rotate; use rainbow() colors
>>    text(1, 1, "Animation", srt = i, col = rainbow(360)[i],
>>        cex = 7 * i/360)
>>    # pause for a while
>>    Sys.sleep(0.01)
>> }
>>
>> The usage is simple:
>>
>> # formatR depends on RGtk+; will be installed automatically

I think he meant RGtk2, and 'attempt to install'.

>> # better use the latest version of R (>=2.10.1)
>> install.packages('formatR')
>> library(formatR)
>> # or formatR()
>>
>> Screen-shots can be found here:
>> http://yihui.name/en/2010/04/formatr-farewell-to-ugly-r-code/
>
> Interested in adding this package but when I tried to load it and its
> dependencies the system spit back that I didn't have the right version of
> Gtk.

You didn't show us the actual message, though, nor tell us if you were 
doing a source package install (or if a binary one, where you got 
binaries from).  I suspect it came from RGtk2 and actually means that 
you do not have all the RGtk2-related development packages installed. 
I had something similar (given the vagueness of your description) 
yesterday on Solaris, when the issue was that I missing gnome-devel (I 
did have gtk-2.0-devel installed).

It is unlikely that you have the components but they are too old.  The 
stated minimum requirement is Gtk 2.8.0 (August 2005).

If you download and unpack the RGtk2 tarball and run R CMD INSTALL on 
it there will be a file RGtk2/config.log: that is what told me what it 
thought I had missing.

> I'm running Ubuntu Linux 8.04 (Hardy Heron) with all the called for
> updates. I've looked in synaptic but I'm not an 'under the hood' type of
> user so I have no clue what to look for in there to find out what I have or
> even if it is possible to update. Oh yes, I'm running v2.10.1 of R.
>
> Is there any likely solution to this situation, or am I SOL because my
> Linux version is now simply too old?
>
> Regards...
> -- 
> Brian Lunergan
> Nepean, Ontario
> Canada
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
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



More information about the R-help mailing list