[R] [R-pkg] New packages pmg, gWidgets, gWidgetsRGtk2

verzani at math.csi.cuny.edu verzani at math.csi.cuny.edu
Sat Oct 7 14:48:57 CEST 2006


I answered Gabor off line, but realize that this may cause some others
confusion. The RGtk2 package requires the GTK libraries to be
installed first. This varies from system to system. Under Windows it
consists of downloading some files from sourceforget (see
below). After which RGtk2 installs like any other R package. 

Gabor brought up an additional point, in my example for gWidgets I have
an argument to gtable() copied twice. The full example should read

    win = gwindow("Select a CRAN mirror")
    size(win) <- c(600,400)
    tbl = gtable(utils:::getCRANmirrors(), chosencol=4, 
      container=win,
      filter.column=2,
      handler = function(h,...) {
        URL = svalue(tbl)
        repos <- getOption("repos")
        repos["CRAN"] <- gsub("/$", "", URL[1])
        options(repos = repos)
        dispose(win)
      })


Finally, for some reason I'm trying to track down, under Windows, pmg
is crashing when a cairoDevice graphics device is being closed. This
affects the plotnotebook and the Lattice Explorer. I have an update to
gWidgetsRGtk2 that may fix it, but I haven't had a chance to fully
test it. It can be installed with

install.packages("gWidgetsRGtk2",repos="http://www.math.csi.cuny.edu/pmg")

--John

"Gabor Grothendieck" <ggrothendieck at gmail.com> writes:

> Hi, I need installation instructions. library(pmg) seems not to be enough.
> Thanks.
>
>> library(pmg)
> Loading pmg()
> Loading required package: gWidgets
> Loading required package: gWidgetsRGtk2
> Loading required package: RGtk2
> Error in dyn.load(x, as.logical(local), as.logical(now)) :
>         unable to load shared library
> 'C:/PROGRA~1/R/R-24~1.0/library/RGtk2/libs/RGtk2.dll':
>   LoadLibrary failure:  The specified procedure could not be found.
>
> Error: package 'RGtk2' could not be loaded
> Error: .onAttach failed in 'attachNamespace'
> Loading required package: pmggWidgetsRGtk
> PMG needs gWidgetsError in assign(x, value, envir = ns, inherits = FALSE) :
>         could not find function "gwindow"
> In addition: Warning message:
> there is no package called 'pmggWidgetsRGtk' in: library(package,
> lib.loc = lib.loc, character.only = TRUE, logical = TRUE,
> Error: .onLoad failed in 'loadNamespace' for 'pmg'
> Error: package/namespace load failed for 'pmg'
>
> On 10/6/06, j verzani <pmgrgui at gmail.com> wrote:
>> I'd like to announce three new packages on CRAN: pmg, gWidgets, and
>> gWidgetsRGtk2.
>>
>> --John Verzani
>>
>> 1  PMG
>> *=*=*=
>>
>>
>>  The pmg package for R provides a relatively simple graphical user
>> interface for R in a manner similar to the more mature RCmdr package.
>> Basically this means a menu-driven interface to dialogs that collect
>> arguments for R functions. This GUI was written with an eye towards
>> simplifying the learning curve of R for introductory statistics
>> students.
>>  The pmg package uses the GTK toolkit via the RGtk2 (1) package by
>> Michael Lawrence. Some features are
>>
>>  - The GUI works under Windows, Mac OS X, Linux/X11
>>  - The GUI takes advantage of GTK's drag-and-drop capabilities.
>>  - Several dialogs for analyses performed in an introductory  statistics
>>   course can be used simply by dragging variables  around.
>>  - With the cairoDevice package, the GUI provides a  notebook interface
>>   to a graphics device that allows UNIX users to  easily manage
>>   multiple graphics devices.
>>
>>
>>
>> 2  gWidgets
>> *=*=*=*=*=*
>>
>>
>>  The RGtk2 package is interfaced with the new gWidgets package, which
>> may be of independent interest to those who would like to add GUI
>> elements to their work.  The gWidgets package provides a
>> toolkit-independent API for interactive GUIs based on the iWidgets API
>> of Simon Urbanek, with additional suggestions given by Philippe Grosjean
>> and Michael Lawrence. The gWidgetsRGtk2 package provides the link
>> between gWidgets and RGtk2, allowing the GTK toolkit to be used through
>> gWidgets. It is possible for others to write a link between gWidgets and
>> some other GUI toolkit.
>>  The gWidgets API is nowhere near as rich as the RGtk2 interface to the
>> toolkit, but is much easier to learn. It is well-suited for simple
>> applications or for rapid prototyping of more complicated applications.
>> An accompanying vignette shows many examples of its use. For a simple,
>> but not trivial, illustration, this code, following chooseCRANmirror(),
>> shows how to use gWidgets to make a dialog for selecting a CRAN mirror.
>> <<
>>    win = gwindow("Select a CRAN mirror")
>>    size(win) <- c(600,400)
>>    tbl = gtable(utils:::getCRANmirrors(), chosencol=4, filter.column=2,
>>      container=win,
>>      filter.column=2,
>>      handler = function(h,...) {
>>        URL = svalue(tbl)
>>        repos <- getOption("repos")
>>        repos["CRAN"] <- gsub("/$", "", URL[1])
>>        options(repos = repos)
>>        dispose(win)
>>      })
>> >>
>>  Two widgets are created: a base window to be a container for the
>> widget that displays a table, which has a few extra arguments shown to
>> indicate its flexibility. The widget to display a table allows a user to
>> double click on a row and expect some action to happen. In this case,
>> the handler for this action sets the value of repos. The svalue() method
>> is used to retrieve the selected value from a widget and the dispose()
>> method is used to remove a window.
>>
>>
>> 3  Installation
>> *=*=*=*=*=*=*=*
>>
>>   Installing pmg requires two steps: installing the GTK libraries and
>> installing the R packages.
>>
>>
>> 3.1  Installing the GTK libraries
>> =================================
>>
>>  RGtk2 requires relatively modern versions of the GTK libraries (2.8.0
>> or higher). Installing the libraries under Windows is easy. Download the
>> runtime installer from sourceforge (2). With linux you may need to
>> upgrade base GTK libraries. The GTK libraries are available under Mac OS
>> X using X11. (I haven't confirmed that is possible for RGtk2 to use the
>> native port of GTK.)
>>  More details at RGtk2's home (3).
>>
>>
>> 3.2  Installing the R packages
>> ==============================
>>
>>  The following R packages are needed: RGtk2, cairoDevice, gWidgets,
>> gWidgetsRGtk2, and pmg. All can be downloaded from CRAN. The
>> gWidgetsRGtk2 depends on gWidgets and RGtk2 and suggests cairoDevice so
>> you may be able to get away with
>> <<
>>  > install.packages(c("gWidgetsRGtk2","pmg"),
>>      dependencies=c("Depends", "Suggests"))
>> >>
>>
>>
>>
>> 4  Starting
>> *=*=*=*=*=*
>>
>>
>>  The GUI is started when the pmg package is loaded. If the GUI is
>> closed, it may be restarted by calling pmg(). An accompanying vignette
>> (vignette("pmg")) describes the GUI.
>>
>>
>> 5  Comments
>> *=*=*=*=*=*
>>
>>
>>  Send comments or suggestions to pmgRgui at gmail.com.
>> -----------------------------------
>>
>>
>>  (1) http://www.ggobi.org/rgtk2
>>
>>  (2) http://gladewin32.sourceforge.net/modules/news/
>>
>>  (3) http://www.ggobi.org/rgtk2
>> -----------------------------------------------------------------------
>>
>>  This document was translated from LaTeX by HeVeA
>>              (http://pauillac.inria.fr/~maranget/hevea/index.html).
>>
>> ______________________________________________
>> R-help at stat.math.ethz.ch 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.
>>
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.



More information about the R-help mailing list