RKWard – a and integrated development environment for statistical analysis with

dipl.-psych. m.eik michalke

heinrich heine universität düsseldorf institut für experimentelle psychologie abt. für diagnostik & differentielle psychologie

microsoft, cologne – 26.II.2016 RKWard | in another life

GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | (some of) my R packages

GUIs for R

RKWard dialogs I koRpus console/editor data text analysis, POS tagging, readability plots packages I klausuR configuration multiple choice test evaluation extendable plugin concept I roxyPackage rkwarddev for packaging R packages feedback I XiMpLe thx XML parser and generator I rkwarddev RKWard plugin generator I iRcotofun a jeopardy game in R ;o)

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept GUIs for R rkwarddev feedback thx

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | GUIs for R

GUIs for R

RKWard JSS special volume 49: dialogs »graphical user interfaces for R« console/editor data plots packages

JSS Journal of Statistical Software JSS Journal of Statistical Software configuration June 2012, Volume 49, Issue 1. http://www.jstatsoft.org/ June 2012, Volume 49, Issue 9. http://www.jstatsoft.org/ extendable plugin concept Graphical User Interfaces for R RKWard: A Comprehensive Graphical User Interface and Integrated Development Environment rkwarddev Pedro M. Valero-Mora Rub´enD. Ledesma for Statistical Analysis with R Universitat de Val`encia Universidad Nacional de Mar del Plata

Stefan R¨odiger Thomas Friedrichsmeier feedback Abstract Charit´e-Universit¨atsmedizin Berlin Ruhr-University Bochum Since R was first launched, it has managed to gain the support of an ever-increasing percentage of academic and professional statisticians. However, the spread of its use Prasenjit Kapat Meik Michalke among novice and occasional users of statistics have not progressed at the same pace, which The Ohio State University Heinrich Heine University Dusseldorf¨ can be atributed partially to the lack of a graphical user interface (GUI). Nevertheless, this situation has changed in the last years and there is currently several projects that thx have added GUIs to R. This article discusses briefly the history of GUIs for data analysis and then introduces the papers submitted to an special issue of the Journal of Statistical Abstract Software on GUIs for R. R is a free open-source implementation of the S statistical computing language and Keywords: GUI, statistical software, R. programming environment. The current status of R is a command line driven interface with no advanced cross-platform graphical user interface (GUI), but it includes tools for building such. Over the past years, proprietary and non-proprietary GUI solutions have emerged, based on internal or external tool kits, with different scopes and technological concepts. For example, Rgui.exe and Rgui.app have become the de facto GUI on the and Mac OS X platforms, respectively, for most users. In this paper 1. Introduction we discuss RKWard which aims to be both a comprehensive GUI and an integrated devel- opment environment for R. RKWard is based on the KDE software libraries. Statistical Nowadays, graphical user interfaces (GUIs) are the most common way of interacting with procedures and plots are implemented using an extendable plugin architecture based on a computer or other electronic devices. Whereas they are arguably not the best way of ECMAScript (JavaScript), R, and XML. RKWard provides an excellent tool to manage different types of data objects; even allowing for seamless editing of certain types. The performing every conceivable job, its dominance has reached the principal operative systems, objective of RKWard is to provide a portable and extensible R interface for both basic application domains, and tasks. Measured it in purely statistical terms, the triumph of this and advanced statistical and graphical analysis, while not compromising on flexibility and style of interaction is unquestionable and it seems clear that it will remain very popular in modularity of the R programming environment itself. the foreseeable future. However, regarding the discipline of statistics, this supremacy does not seem so dramatically Keywords: GUI, integrated development environment, plugin, R. clear, as many of the people working in this field seem to favor that using a typed language via a command line interface (CLI) is a much more productive, accurate and reproducible way of performing their tasks than a GUI. Actually, we are positive that they are right, because writing up commands can be undoubtedly much more productive than using a GUI, as far as 1. Background and motivation the learning cost is not included in the bill. Thus, although getting the knowledge to manage a command-based language is within reason if you are going to use it very often, the novice In mid 1993 Ihaka and Gentleman published initial efforts on the computing language and and occasional users of statistical software may not ever see sufficient returns to justify the programming environment R on the s-news mailing list. Ambitions for this project were to

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx RKWard

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | about

GUIs for R

RKWard I combines GUI and IDE dialogs console/editor B to satisfy both newbies and gurus data plots B easy to extend packages configuration I mere desktop application extendable B no server, but R backend configurable plugin concept rkwarddev I multi-platform (thanks to ) feedback B MS Windows thx B OS X B GNU/ I free software (GPL v2+) I download: http://rkward.kde.org B part of the KDE family

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | born out of frustraion

GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx phil manker (CC BY) © »COBOL rube goldberg«

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | is brought to you by

GUIs for R

RKWard dialogs console/editor I thomas friedrichsmeier data plots B and many others... packages configuration I until now 48 official releases extendable plugin concept I some milestones: rkwarddev 0.1.0 (19.11.2002) first release feedback 0.4.0 (17.10.2006) i joined the team;o) thx 0.5.1 (04.08.2009) windows port 0.5.5 (15.03.2011) external plugins 0.6.0 (24.12.2012) OS X port 0.6.4 (21.12.2015) most recent release

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx main window

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | startup RKWard | main window RKWard | main window: workspace browser RKWard | main window: file browser RKWard | main window: R console RKWard | main window: debugger RKWard | main window: online help RKWard | main window: results in HTML GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx dialogs

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | dialog windows

GUIs for R

RKWard dialogs data analysis plots console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | dialogs: power analysis

GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | dialogs: mandatory fields

GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | dialogs: code

GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | dialogs: wizard

GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | dialogs: online help GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx R console & code editor

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | R console & code editor

GUIs for R

RKWard R console: dialogs console/editor data plots packages configuration extendable I plugin concept code editor: rkwarddev I code hinting feedback I code folding thx I code blocks

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx working with data import/edit/export

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | data import/export

GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | import SPSS files

GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | data.frame editor RKWard | export CSV files

GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx plots preview, history & export

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | plot preview, history & export

GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | export to TikZ format (LATEX) GUIs for R

RKWard Sales development 2003-2009 dialogs console/editor

600 Illegal downloads (tracks) data CD sales (albums) plots Payed downloads (tracks) CD sales (singles)

packages 500 Payed downloads (bundles) configuration

extendable 400 plugin concept rkwarddev 300 feedback

thx 200 Sales/downloads in millions 100 2010 OMC e. V. (CC BY-SA) 0 ©

2003 2004 2005 2006 2007 2008 2009

Data: Financial reports Bundesverband Musikindustrie, 2004-2009 »mythos raubkopie«

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx package management

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | R packages: installed locally

GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx configuration

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | configuration

GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx plugin concept

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | the plugin concept

GUIs for R

RKWard dialogs I dialogs are implemented as plugins console/editor data B QA: support for unit tests plots packages B i18n: support for translations configuration I you can extend RKWard with your own plugins extendable plugin concept B can be packaged/installed as R packages rkwarddev B https://github.com/rkward-community feedback B rk.ANOVA thx B rk.ClusterAnalysis B rk.FactorAnalysis B rk.gitInstall B rk.MultidimensionalScaling B ...

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | R packages: RKWard plugins

GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | plugins: XML & JavaScript

GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | example: radio button

GUIs for R RKWard radio button: define GUI in XML dialogs console/editor configuration extendable plugin concept rkwarddev feedback thx

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | example: radio button

GUIs for R

RKWard dialogs radio button: generate R code with JavaScript console/editor var hypothesis = getValue("hypothesis"); data var x = getValue("x"); plots var y = getValue("y"); packages echo("result <- t.test (x="+x+ ", y=" + y); configuration echo(", alternative=\"" + hypothesis +"\"\n"); extendable plugin concept rkwarddev feedback thx

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx rkwarddev

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | rkwarddev: documentation

GUIs for R RKWard how-to as vignette in the package dialogs console/editor data plots

packages configuration RKWard plugin development with the rkwarddev package Now, wouldn’t it be nice to see how that looks like in RKWard? Well, you can: > rk.plugin.skeleton( m.eik michalke + about="Example plugin", extendable + xml=list(dialog=myDialog), November 9, 2014 + load=TRUE, + show=TRUE plugin concept + ) Writing plugins for RKWard means writing at least two XML files (a For filenames ‘Example plugin’ was renamed to ‘Exampleplugin’. GUI description and a plugin map), one JavaScript file (to create the R Created directory /tmp/Rtmp9gdThb/Exampleplugin. code), maybe a help file (again in XML), and for plugins who should be Created directory /tmp/Rtmp9gdThb/Exampleplugin/R. rkwarddev distributed, a DESCRIPTION file. Furtermore, all of these files need to Created directory /tmp/Rtmp9gdThb/Exampleplugin/inst/rkward/plugins. be in a certain directory structure. Created directory /tmp/Rtmp9gdThb/Exampleplugin/inst/rkward/tests/Exampleplugin. The rkwarddev package aims to simplify this, by enabling you to fulfill For filenames ‘Example plugin’ was renamed to ‘Exampleplugin’. all the listed tasks in just one R script. For filenames ‘Example plugin’ was renamed to ‘Exampleplugin’. For filenames ‘Example plugin’ was renamed to ‘Exampleplugin’. feedback For filenames ‘Example plugin’ was renamed to ‘Exampleplugin’. 1 About the package [1] "/tmp/Rtmp9gdThb/Exampleplugin" You might ask why you should write R scripts to generate plugins, if you could just Allthough until now all we did was to outline the XML description of our plugin- directly write the XML and JavaScript files. First of all, you don’t have to use this to-become, rkwarddev can already generate a full plugin. load=TRUE makes sure that package at all, it’s totally fine to code your plugins how ever you like. The main RKWard recognizes the new plugin immediately after it was created, and show=TRUE reason why I wrote this package is that I like to really concentrate on what I’m doing, will even make it pop up, too: thx so this is my attempt to avoid the need to switch between several files in three different languages all the time. I wanted to be able to constantly ”think in R“ while working on a plugin, and to oversee everything that matters in one script. As a side effect, a lot of useful automation was implemented, so using this package will definitely save you quite some amount of typing.

2 Before we start

It is important to understand that while rkwarddev can help you to make designing new plugins much easier, you still need to know how the generated XML and JavaScript files work and interact. That is, if you didn’t yet read the Introduction to Writing Plugins for RKWard,1 please do so before you start working with this package. Once you’re sure you understand how plugins in RKWard actually work, just come back here. Not bad for less than 20 short lines of code. This makes dialog design both very efficient and flexible: Imagine you want to re-arrange the order of elements, or exper- 1http://rkward.sourceforge.net/documents/devel/plugins/index.html iment with completely different tabbook layouts, all you need to do is to change the

1 7

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | XML with rkwarddev

GUIs for R

RKWard dialogs console/editor data functions for XML & JavaScript plots > hypo <- rk.XML.radio(label="using test hypothesis", id.name="hypothesis", packages + options=list( configuration + "Two-sided"=c(val="two.sided"), extendable + "First is greater"=c(val="greater"), + "Second is greater"=c(val="less") plugin concept + ) rkwarddev + ) feedback > hypo thx > cat(echo(", alternative=\"", hypo, "\"\n")) echo(", alternative=\"" + hypothesis + "\"\n");

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable plugin concept rkwarddev feedback thx »developers, developers, developers...«

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet RKWard | feedback

GUIs for R

RKWard dialogs console/editor data plots packages configuration extendable I download: http://rkward.kde.org plugin concept rkwarddev I feedback: [email protected] feedback I twitter: @RKWardNet thx

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet GUIs for R

RKWard thx! dialogs console/editor data questions? ideas? comments? plots packages configuration twitter: @yrlaNor extendable plugin concept rkwarddev references feedback I RKWard Development Team (2015). RKWard Version 0.6.4. thx http://rkward.kde.org I Rödiger, S., Friedrichsmeier, T., Kapat, P. & Michalke, M. (2012). RKWard: A comprehensive graphical user interface and integrated development environment for statistical analysis with R. Journal of Statistical Software, 49(9). I Michalke, M. (2015). rkwarddev: A collection of tools for RKWard plugin development. R package version 0.08-1. http://files.kde.org/rkward/R/pckg/rkwarddev/

dipl· psych· m·eik michalke | https://rkward.kde.org | twitter: @RKWardNet