[Rd] Building an R GUI using gWidgets and RGtk2

From: Gerlanc, Daniel <Daniel.Gerlanc_at_geodecapital.com>
Date: Fri, 14 Sep 2007 16:52:14 -0400


I'm developing a GUI in R that will be used to monitor financial portfolio performance. The GUI will be distributed as an R package. So far, I've decided to use the "cairoDevice", "RGtk2", "gWidgets", and "gWidgetsRGtk2" packages to develop the GUI. I am trying to decide what would be the best way to structure the GUI would be.

I've considered 3 approaches to building the GUI. The first would be to use S4 classes. I would create parent "gui" object that would store widgets or containers in slots. Other more specialized guis for different purposes would extend this parent "gui" object. The difficulty in this approach is R's use of pass-by-value. Once the gui object has been created, changing any of the slots of the gui requires returning a new GUI object or saving one off in a higher level environment and editing the slots directly. Editing the slots directly would completely bypass the S4 method dispatch.

Another approach would be more functional. I would create variables that are global within the package or in their own environment and define the package function closures within this environment. This could work, but the code could get noisy when calls to have be made to distinguish between local variable assignment within the environment of the functions and assignment within the namespace of the package.

The third approach I've been considering is using the R.oo package. I have never used this package before but it appears to provide similar OO features to Java. Because it allows references, it would seem to provide the features I'm looking for from both the S4 and functional approaches.

Any comments or suggestions on these different approaches would be appreciated.

Thank you.


Daniel Gerlanc

R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 14 Sep 2007 - 20:53:54 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 15 Sep 2007 - 14:41:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.