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 gWidgets package. The pmg package uses the GTK toolkit via the RGtk2 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 Installation
Installing pmg requires two steps: installing the GTK libraries and installing the R packages. If the GTK libraries are already installed, then pmg may be installed with
> install.packages("pmg", dep=TRUE)
(You may need type=ßource" under Mac OS X.)
For Windows users, the
following command automates the installation including installing GTK
if needed:
> source("http://www.math.csi.cuny.edu/pmg/installpmg.R")
For Mac OS X users, the gtk libraries can be found bundled up at
http://r.research.att.com/gtk2-runtime.dmg. These are to be run
from within an X11 session (not the R GUI for Mac).
2.1 Installing the R packages
The following R packages are needed: RGtk2, cairoDevice, gWidgets, gWidgetsRGtk2, and pmg. Install them in this order, as some depend on others to be installed first. All can be downloaded from CRAN. As the "Suggests" value for pmg contains gWidgets and gWidgetsRGtk2 which in turn suggest RGtk2 and cairoDevice this can be achieved from the command line with
install.packages("pmg", dep = TRUE)
You may need to adjust the location where the libraries will be
installed if you do not have the proper permissions.
3 Try out pmg
The package may be started with> library(pmg)A screenshot can be seen at http://www.math.csi.cuny.edu/pmg/Screenshots. If the GUI Is closed, it may be restarted with the command pmg(). The pmg package provides a short vignette with some examples. You may read this with the command
> vignette("pmg") # read about some examples
4 gWidgets
The pmg GUI is written using the gWidgets package. This package trades off the power of directly using RGtk2 for a more R-like interface. It can be used independently of pmg or to add to pmg. To learn more see http://www.math.csi.cuny.edu/pmg/gWidgets.5 Comments
Send comments or suggestions to pmgRgui@gmail.com.File translated from TEX by TTH, version 3.67.
On 9 Oct 2007, 12:30.
11/17/2008: New versions of gWidgets, gWidgetsRGtk2, gWidgetstcltk, gWidgetsrJava
A few additions (gaction, tooltip), and a lot of bug fixes.
07/18/2008: New package gWidgetsWWW
The gWidgetsWWW package leverages the Rpad infrastructure allow
dynamic webpages to be built using the gWidgets API. In addition the
Rpad package for R, these pages use the EXTJS javascript libraries
available at www.extjs.com.
Att this point, much of the gWidgets API is implemented, but certainly
not all. In addition, some extenstions are being tried out. The
gaction contructor is used to make reusable action components for
menubars and buttons. The ggooglemaps constructor gives some access to
the Google maps interface.
Bug reports and comments are welcome.
07/18/2008: gWidgetstcltk needs tcl/tk 8.5
The gWidgetstcltk package now needs tcl/tk version 8.5 or newer
installed. This change was made when R 2.7.0 shipped this version for
windows. The 8.5 version allows for many more widgets, that prior to
this were hacked or ignored in gWidgetstcltk.
For windows this is not issue, for linux users not a big issue, for
Mac OS X users, one needs to (I think) compile the tcl/tk libraries
from source (www.tcl.tk). This has been confirmed to work for
gWidgetstcltk under OS X 10.5, but YMMV.
07/18/2008: New versions of gWidgetsRGtk2, tcltk and rJava uploaded
Basically these are minor bugfixes and documentation tweaks to make
CRAN happy. Fixes include: gframe in gWidgetstcltk and fixes to
methods for gradio, gvarbrowser and gpanedgroup in gWidgetsRGtk2.
Future changes (hopefully) will fix up the gdf constructor in
gWidgetsRGtk2 and documentation imporvements to gWidgets itself.
05/17/2008: gWidgetsRGtk2_0.0-34
New version which fixes a bug in gcheckboxgroup and add to the method [<-.
10/30/2007: Stack smashing issue
Under Kubuntu the following example was throwing a stack smashing
error with R-2.6.0:
library(RGtk2)
w = gtkWindowNew("test")
b = gtkButton("click me")
w$Add(b)
connectSignal(b,"clicked",function(...) {
e = simpleError("test")
stop(e)
}
If you see this error, recompile after first setting
export CFLAGS="-fno-stack-protector"
09/24/2007: New versions of gWidgets, gWidgetsRGtk2, gWidgetsrJava, and gWidgetstcltk
I uploaded new versions of these 4 packages to CRAN today. Mostly bug
fixes:
- Changed rJava so that it works without JGR. This was made possible in rJava-0.5-0.
- fixed gtree issue with icons in RGtk2
- Fixed gtable in tcltk. Made obj[,] <- c() work. (Not in RGtk2 though!)
- Fixed bug in rJava with gbutton and glabel
09/19/2007: Added a set of examples
Look at the Examples directory to see a number of annotated examples
of how gWidgets can be used.
07/12/2007: New version of pmg uploaded to CRAN
A new version of pmg was uploaded to CRAN. There were a few bug
fixes. As well, the layout changed slightly. The Commands tab is no
longer in the main notebook, but rather appears below it. This makes
it more accessible and when a dialog is used the output appears to the
user. It might take more screen real estate to work. As well, I think
I managed to avoid requiring iplots (and hence rJava) and reshape from
being installed when the package is installed. The GUI has some
entries to enhance these two packages, but they are not necessary.
07/12/2007: A new package gWidgetstcltk is uploaded to CRAN
This package incorporates tcltk into the gWidgets framework. Although not all the widgets are implemented, due to a desire to make this work with the base tcltk libraries, many are.
The major difference between this implementation and gWidgetsRGtk2 and gWidgetsrJava is how containers are handled. In the latter two, a container can be specified for a widget after the widget is constructed, in gWidgetstcltk the container must be specified when a widget is constructed. So instead of using something like:
b = gbutton("click me")
g = ggroup(cont=gwindow("example"))
add(g, b, expand=TRUE)
you would write
g = ggroup(cont=gwindow("example"))
b = gbutton("click me", container=g, expand=TRUE)
The expand=TRUE is there to show that argumentst to add may be passed
into the widget using the ... feature of R.
![[DIR]](http://wiener.math.csi.cuny.edu/pmg/images/i-directory-12.png)
![[FILE]](http://wiener.math.csi.cuny.edu/pmg/images/i-regular-12.png)