Graphical User Interfaces

Want to write an R program that you (and others) can use without re-writing code? It is easy to do in R – just write a graphical user interface! This tutorial will walk you through using the gWidgets package to create an interface that will let you preform analyses by clicking buttons, dragging sliders, selecting from menus, and entering text!

Since most of the school’s rooms are booked for open house, we won’t have a lecture this week. However, I’ll be available in room 201 Rosenau (student study space) for any R questions from 10:30-11:30.

Lab: gui.R

Edit: During the lab today I realized that the GUI toolkit we are using (GTK) can be finicky to install at first. R should pop up a box asking if you want to install GTK when you run the install.packages command from the script. If it dosen’t, here are some things we tried to get it to install correctly:

1. Make sure you have the upper/lower cases right (gWidgetsRGtk and RGtk).
2. Make sure you have the latest version of R itself (from CRAN: http://cran.r-project.org/). The RStudio version shouldn’t matter.
3. Try installing and loading the RGtk2 package first: install.packages("RGtk2")
library(RGtk2)

3. If you are using linux, semi-manually install the gtk development package:
sudo apt-get install libgtk2.0-dev
Youll get lots of Scary Text when you install the package in linux (as usual) but it should finish compiling eventually.
4. Restart R and try again.