Presentation is loading. Please wait.

Presentation is loading. Please wait.

An Introduction to GUI Development using R

Similar presentations


Presentation on theme: "An Introduction to GUI Development using R"— Presentation transcript:

1 An Introduction to GUI Development using R

2 Overview Introduction Programming for GUIs
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 KDnuggets.com (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 Packages Description DeducerExtras Additional dialogs and functions for Deducer DeducerPlugIn Example Deducer Plug-in Example DeducerPlugInScaling Reliability and factor analysis plugin DeducerSpatial Deducer for spatial data analysis DeducerSurvival Add Survival Dialogue to Deducer DeducerText Deducer 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 discussion

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 man’s GUI, similar to Rcmdr)

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

17 Package description ade4TkGUI GUI for ade4 package AtelieR Basic statistical inference & bayesian analysis BiodiversityR Biodiversity, suitability, community ecology analysis biOpsGUI Basic image operations BiplotGUI Interactive Biplots in R CADStat Statistical methods useful for causal assessment caGUI A Tcl/Tk GUI for the functions in the ca package cncaGUI Canonical Non-symmetrical Correspondence Analysis DALY Stochastic DALY calculations detrendeR Start the detrendeR Graphical User Interface (GUI) digeR GUI tool for analyzing 2D DIGE data GGEBiplotGUI GGEBiplotGUI: Interactive GGE Biplots in R GrapheR Multi-platform GUI for drawing customizable graphs MDSGUI A GUI for interactive MDS in R MergeGUI A GUI for Merging Datasets in R Metabonomic GUI for Metabonomic Analysis

18 Package description migui Graphical User Interface of the mi Package MissingDataGUI A GUI for Missing Data Exploration MSeasyTkGUI multibiplotGUI Multibiplot Analysis in R mutossGUI A graphical user interface for the MuToss Project PBSadmb ADMB for R Using Scripts or GUI PMSddesolve Solver for Delay Differential Equations PBSmapping Mapping Fisheries Data and Spatial Analysis Tools PBSmodelling Interact with Models, Explore Data, Dynamic Presentations playwith A GUI for interactive plots using GTK+ pmg Poor Man's GUI ProgGUIinR book "Programming Graphical User Interfaces in R" QCAGUI QCA Graphical User Interface R2STATS Fit and compare GLM and GLMM in R RandForestGUI Random Forests RenextGUI GUI for Renext

19 Package description ResearchMethods GUIs to help teach statistics to non-statistics students reshapeGUI A GUI for the reshape2 and plyr packages RPMG Interactive R analysis sessions RunuranGUI A GUI for the UNU.RAN random variate generators Rz GUI Tool for Data Management like SPSS or Stata sculpt3d A simple toolbar GUI for brushing RGL plots sdcMicroGUI Graphical user interface for package sdcMicro SeqGrapheR Graph based visualization of cluster of DNA seq reads Sim.DiffProcGUI Simulation of Diffusion Processes speedR A GUI based importing and filtering tool TGUICore Teaching GUI - Core functionality TGUITeaching Teaching GUI - prototype tourrGUI A Tour GUI using gWidgets traitr creating GUIs (traits UI module for python) WMCapacity Bayesian working memory models x12GUI X12 - Graphical User Interface

20 Package description Common JavaJars Useful libraries for building a Java based GUI fgui Function GUI miniGUI tktcl 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 sagemath.org, writen in Python & Cython, not supported by MS Windows

22 Web-applications rApache project (www.rapache.net) Rook package
Embed R in the Apache web server Rook package Provides an interface to build web-applications with rApache gWidgetsWWW It’s 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 Don’t 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"

Similar presentations


Ads by Google