Presentation is loading. Please wait.

Presentation is loading. Please wait.

An Introduction to GUI Development using R. Overview Introduction –R Interfaces –GUIs for programming Programming for GUIs –GUIs for teaching how to program.

Similar presentations

Presentation on theme: "An Introduction to GUI Development using R. Overview Introduction –R Interfaces –GUIs for programming Programming for GUIs –GUIs for teaching how to program."— Presentation transcript:

1 An Introduction to GUI Development using R

2 Overview Introduction –R Interfaces –GUIs for programming Programming for GUIs –GUIs for teaching how to program –GUI task-oriented applications –gWidgets package Integrating R into other applications –GUI deployment

3 Introduction R Interfaces/Console alternatives RStudio –Programmed in C++ and GTK+ JGR –Java Revolution R Productivity Environment (RPE) –MS Visual Studio Red-R (Open Source visual programming for R SciViews (extends Komodo edit)

4 GUIs for Programming (code editors) R internal editor (on Mac!) Emacs + ESS Eclipse + StatET Gvim/Vim-R Notepad++ / NppToR WinEdt/RWniEdt ($30!!!) Tinn-R (MS Windows only) jEdit (doesn't pass code to R)

5 GUIs to learn programming R Commander (Rcmdr package) –Satistical analysis functions RKWard (Linux only)

6 Poll from (data miners!)

7 GUI Programming using R gWidgets package –written by J. Verzani –gWidgets provides a toolkit-independent API for building interactive GUIs. –At least one of gWidgetstcltk, gWidgetsRGtk2, gWidgetsQt (on R-Forge only) and qWidgetsrJava needs to be installed. –i.e. GUI toolkits must be installed (except Tcltk, pre-installed, default) –the user can switch between GUI toolkits with relative ease and can write code in a toolkit independent way Well, not quite

8 GTK+ toolkit

9 gWidgets functions

10 GUI contruction using gWidgets Use containers (in ggroup, gwindow, gnotebook functions) to nest widgets Handlers i.e. event handling, define the executed operation Handlers can be added after the GUI is created e.g. addHandlerClicked(…) Drag-and-drop is also featured in gWidgets Demo.... library(gWidgets) options("guiToolkit"="RGtk2") win <- gwindow("Hello World, ad nauseum", visible=TRUE) group <- ggroup(horizontal = FALSE, container=win) obj <- gbutton("Hello...",container=group, handler = function(h,...) gmessage("world")) obj <- glabel("Hello...", container =group,handler = function(h,...) gmessage("world")) obj <- gcombobox(c("Hello","world"), container=group) obj <- gedit("Hello world", container=group) obj <- gtext("Hello world", container=group, font.attr=list(style="bold"))

11 Sample Problem Survey conducted to see changes in HIV and non-HIV services in sub-Saharan Africa –Conducted across health centres & hospitals, also individual health-worker data, in several sub- saharan Africa countries Relatively small questionnaire resulting in 800 variables! –Variables names themselves are not very useful e.g. Q001. Great scope for programming error –Variable labels (the actual questions) contain the information on what is collected –With the concept of variable names dropped, an interactive GUI might work better with variable labels than programming!

12 Solution Create new sets of labels –which work as indexes –These can be used to filter, manage and analyze data - Restructuring of data not required Begin with a search & replace dialogue screen –How would you design it (so that it would be a better option than just using grep or regexpr)? Demo...

13 Deducer An intuitive, cross-platform graphical data analysis system Deducer is based upon rJava and provides access to the Java Swing Network Related PackagesDescription DeducerExtrasAdditional dialogs and functions for Deducer DeducerPlugIn ExampleDeducer Plug-in Example DeducerPlugInScalingReliability and factor analysis plugin DeducerSpatialDeducer for spatial data analysis DeducerSurvivalAdd Survival Dialogue to Deducer DeducerTextDeducer GUI for Text Data

14 gWidgets versus Deducer Deducer has a slightly lower level library, but more flexible and compatible with JGR Deducer requires you to explicitly specify positions of widgets, and is a little more verbose when you come to add event handling logic Visit for a

15 Other R GUI packages and tools (which I know little about!) PBS (Pacific Biological Station) packages Rattle (data mining GUI) Brodgar (used for class-room teaching etc.) pmg (poor mans GUI, similar to Rcmdr)

16 Current List of Packages with tools for GUI development or utilize a programmed GUI* *as of January 2013

17 Packagedescription ade4TkGUIGUI for ade4 package AtelieRBasic statistical inference & bayesian analysis BiodiversityRBiodiversity, suitability, community ecology analysis biOpsGUIBasic image operations BiplotGUIInteractive Biplots in R CADStatStatistical methods useful for causal assessment caGUIA Tcl/Tk GUI for the functions in the ca package cncaGUICanonical Non-symmetrical Correspondence Analysis DALYStochastic DALY calculations detrendeRStart the detrendeR Graphical User Interface (GUI) digeRGUI tool for analyzing 2D DIGE data GGEBiplotGUIGGEBiplotGUI: Interactive GGE Biplots in R GrapheRMulti-platform GUI for drawing customizable graphs MDSGUIA GUI for interactive MDS in R MergeGUIA GUI for Merging Datasets in R MetabonomicGUI for Metabonomic Analysis

18 Packagedescription miguiGraphical User Interface of the mi Package MissingDataGUIA GUI for Missing Data Exploration MSeasyTkGUIA GUI for Missing Data Exploration multibiplotGUIMultibiplot Analysis in R mutossGUIA graphical user interface for the MuToss Project PBSadmbADMB for R Using Scripts or GUI PMSddesolveSolver for Delay Differential Equations PBSmappingMapping Fisheries Data and Spatial Analysis Tools PBSmodellingInteract with Models, Explore Data, Dynamic Presentations playwithA GUI for interactive plots using GTK+ pmgPoor Man's GUI ProgGUIinRbook "Programming Graphical User Interfaces in R" QCAGUIQCA Graphical User Interface R2STATSFit and compare GLM and GLMM in R RandForestGUIRandom Forests RenextGUIGUI for Renext

19 Packagedescription ResearchMethodsGUIs to help teach statistics to non-statistics students reshapeGUIA GUI for the reshape2 and plyr packages RPMGInteractive R analysis sessions RunuranGUIA GUI for the UNU.RAN random variate generators RzGUI Tool for Data Management like SPSS or Stata sculpt3dA simple toolbar GUI for brushing RGL plots sdcMicroGUIGraphical user interface for package sdcMicro SeqGrapheRGraph based visualization of cluster of DNA seq reads Sim.DiffProcGUISimulation of Diffusion Processes speedRA GUI based importing and filtering tool TGUICoreTeaching GUI - Core functionality TGUITeachingTeaching GUI - prototype tourrGUIA Tour GUI using gWidgets traitrcreating GUIs (traits UI module for python) WMCapacityBayesian working memory models x12GUIX12 - Graphical User Interface

20 Packagedescription Common JavaJarsUseful libraries for building a Java based GUI fguiFunction GUI miniGUItktcl quick and simple function GUI

21 Considerations in GUI development & deployment Which Widget library? –GTK+, Java, Qt? Program the UI or use a UI designer? –e.g. QtDesigner Choice of software for GUI deployment? –R (gWidgets package etc.) –Python (wxPython, PyQt, PyQt4 libraries) R/Python integration (call R using Rpy, Rpy2) –Sage ( Sage uses existing open-source libraries wherever they exist! See, writen in Python & Cython, not supported by MS Windows

22 Web-applications rApache project ( –Embed R in the Apache web server Rook package –Provides an interface to build web- applications with rApache gWidgetsWWW –Its independent of gWidgets! –Use JavaScript libraries, rapache Shiny in Rstudio!!!

23 Documentation Lots of material on the web Journal of Statistical Software (Vol. 49) –Special issue of R on GUIs Lawrence and Verzani book (2012) gWidgets package vignette

24 Final comments Dont write a GUI which you hope others will find useful. Write one you use yourself and hopefully it may be of use other people A successful GUI will requires the right balance of detail and simplicity Writing a GUI using R may not be the optimal deployment of a GUI, but it is nevertheless easy to do! –It is my opinion that programing from within R is a very good way to get a working GUI quickly, but you are better served leaving R for something polished and professional looking. R-Blogger

25 Thank you!

Download ppt "An Introduction to GUI Development using R. Overview Introduction –R Interfaces –GUIs for programming Programming for GUIs –GUIs for teaching how to program."

Similar presentations

Ads by Google