An introduction to gui development using r
Download
1 / 25

An Introduction to GUI Development using R - PowerPoint PPT Presentation


  • 59 Views
  • Uploaded on

An Introduction to GUI Development using R. 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.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' An Introduction to GUI Development using R' - wyoming-gallegos


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Overview
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


Introduction r interfaces console alternatives
IntroductionR 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)


Guis for programming code editors
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)


Guis to learn programming
GUIs to learn programming

R Commander (Rcmdr package)

Satistical analysis functions

RKWard (Linux only)



Gui programming using r
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


Gtk toolkit
GTK+ toolkit

www.gtk.org


Gwidgets functions
gWidgetsfunctions


Gui contruction using gwidgets
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"))


Sample problem
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!


Solution
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...


Deducer
Deducer

“An intuitive, cross-platform graphical data analysis system”

Deducer is based upon rJava and provides access to the Java Swing Network


Gwidgets versus deducer
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 www.r-bloggers.com for a discussion


Other r gui packages and tools which i know little about
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)


Current list of packages with tools for gui development or utilize a programmed gui
Current List of Packages with tools for GUI development or utilize a programmed GUI*

*as of January 2013


Considerations in gui development deployment
Considerations in GUI development & deployment utilize a programmed GUI*

  • 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 (www.sagemath.org)?

      • Sage uses existing open-source libraries wherever they exist!

      • See sagemath.org, writen in Python & Cython, not supported by MS Windows


Web applications
Web-applications utilize a programmed GUI*

  • rApache project (www.rapache.net)

    • 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!!!


Documentation
Documentation utilize a programmed GUI*

  • 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


Final comments
Final comments utilize a programmed GUI*

  • 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


Thank you
Thank you! utilize a programmed GUI*


ad