Easing access to R using 'shiny' to create graphical user interfaces:
An example for the R package 'Luminescence'

Christoph Burow1, Sebastian Kreutzer2, Michael Dietze3, Margret C. Fuchs4, Christoph Schmidt5, Manfred Fischer5, Helmut Brückner1


Abstract

Affiliations

« Working with the command-line interface (CLI) of R can be tedious at best and overwhelming at worst. »

An anonymous userR

Expectation

Reality

« For users with little or no experience with command-lines (CLI) a graphical user interface (GUI) offers intuitive access that counteracts the perceived steep learning curve of a CLI »

Burow et al. (2016)

  Creating a plot: a common task in R

Consider the following situation:
You, as a scientist, are facing the task to visualise your data in a more complex chart using R. Let us further assume that someone else already provided a custom R function that produces this kind of non-standard plot (here: plot_AbanicoPlot()). The desired plot may look like the one below.

Hello Shiny!

Input Widgets

This is a non-exhaustive collection of input widgets available in the shiny framework. Most of the widgets here are bound to a parameter of the plot on the right-hand side. Feel free to test them all and observe its effect on the plot. You can also check the R console output to see the value returned by each widget.

Action button

Checkbox

Checkbox group

Date input

Date range

to

File input

Numeric input

Radio buttons

Select box

Slider

Slider range

Text input

« Sharing shiny applications is simple! »

Another anonymous userR

« R allows the creation of complex and transparent data analysis routines for experimental protocols that are not available in existing software. »

Kreutzer et al. (2012)

Why?

For routine luminescence dating applications the commonly used [measurement devices] are bundled with analysis software, such as Viewer or Analyst. These software solutions are appropriate for most of the regular dating and publication jobs, and enable assessment of luminescence characteristics and provide basic statistical data treatment. However, for further statistical analysis and data treatments, this software may reach its limits. In such cases, open programming languages are a more appropriate approach.
modified after Kreutzer et al. (2012)

A potpourri of functions

Since its release in 2012 the functionality of the R package Luminescence drastically increased. What started with a handful of functions to apply a very specific type of signal analysis and to plot the data is now a collection of >100 functions for all sorts of (non-)specialised tasks.

Current content of Luminescence (v0.8.0)

Statistics

It is generally hard to measure and keep track of the distribution and reception of the R package Luminescence (or RLumShiny). The official CRAN download statistics, however, may provide at least some indication on how many and where people are using our package. The data you see on the right-hand side are generated from the raw CRAN logs.

Motivation

The general motivations have already been outlined in the introduction. In short, using the R command-line can be tedious, even if your experienced in R. If you are new to R and only want to quickly produce a plot, the initial experience can be overwhelming.

In the context of the R package Luminescence over the time we learned that many colleagues were struggling to get started with the package. While writing tutorials and manuals helped to ease the access to the package, it still takes a certain amount of dedication to learn the basic functionality of the package. Quite understandably many colleagues do not feel like having to learn basic R programming first only to use a very small subset of functions provided by the package. By providing a GUI to at least some of the more basic and/or 'popular' functions of the Luminescence package we can are able to practically remove these restrictions and make both R and the Luminescence more accessible to our colleagues.

« [...] 'shiny' is based on modern programming and markup languages, which allows easy integration of existing JavaScript libraries, thus greatly increasing the capabilities of 'shiny' and R itself. »

Burow et al. (2016)

RLumShiny::jscolorInput()

jscolorInput(inputId, label, value, position = 'bottom', color = 'transparent', mode = 'HSV', slider = TRUE, close = FALSE)

The RLumShiny package includes the JavaScript library jscolor (http://jscolor.com/) along with a function to create a JSColor (Javascript/HTML Color Picker) widget to be used in shiny applications.


                        

RLumShiny::popover()

popover(title, content, header = NULL, html = TRUE, class = 'btn btn-default', placement = c('right', 'top', 'left', 'bottom'), trigger = c('click', 'hover', 'focus', 'manual'))

Create a bootstrap button with popover, i.e. a small overlays of content for housing secondary information.

Click me!

RLumShiny::tooltip()

tooltip(refId, text, attr = NULL, animation = TRUE, delay = 100, html = TRUE, placement = 'auto', trigger = 'hover')

Create bootstrap tooltips for any HTML element to be used in shiny applications.

A collection of useful resources

This presentation

The code of this presentation is freely available on GitHub