Home > Research > Activities > Workshop 'Data dashboards and Binder environmen...
View graph of relations

Workshop 'Data dashboards and Binder environments', co-organised with N8 CIR

Activity: Participating in or organising an event typesParticipation in workshop, seminar, course


Workshop at University of York (date to follow)
Information: https://github.com/pablobernabeu/Data-is-present/blob/master/N8-CIR-workshops.mdData dashboards
Data dashboards

Data dashboards are web applications used to visualise data in detail through tables and plots. They assist in explaining and accounting for our data processing and analysis. They don't require any coding from the end user.

These all-reproducible dashboards are published as websites, and thus, they can include hyperlinks and downloadable files. Some of the R packages used are knitr, kableExtra, reactable, ggplot2, plotly, rmarkdown, flexdashboard and shiny. The aim is to practise creating different forms of dashboards—Flexdashboard and Shiny—the latter of which offers greater features, and to practise also with the hosting platforms fitting each type—such as personal websites, RPubs, Binder, Shinyapps and custom servers. A great thing about dashboards is that they may be made very simple, but they can also be taken to the next level using some HTML, CSS or Javascript code (on top of the back-end code present in the R packages used), which is addressed in the second part of this workshop.

Binder environments and improving data dashboards

Binder is a tool to facilitate public access to software environments—for instance, by publishing an RStudio environment on the internet. Binder can also host Shiny apps. It is generously free for users. After looking at the nuts and bolts of a deployment, participants will be able to deploy their own Binder environments and check the result by the end of the workshop. For this purpose, it's recommended to have data and R code ready, ideally in a GitHub repository.

Improving data dashboards

We will practise how to improve the functionality of dashboards using some HTML, CSS and Javascript code, which is the basis of websites.

<!-- Javascript function to enable a hovering tooltip --><script>$(document).ready(function(){ $('[data-toggle="tooltip1"]').tooltip();});</script>

Trade-offs among dashboards

Next, we will turn to data dashboards, to gain further experience with three types—Flexdashboard, Shiny and Flexdashboard-Shiny—and with the suitable hosting platforms. Firstly, the strength of Flexdashboard (example) is its basis on R Markdown, yielding an unmatched user interface (front-end). Secondly, the strength of Shiny (example) is the input reactivity (back-end) it offers, allowing users to download sections of data they select, in various formats. Last, Flexdashboard-Shiny (example) combines the best of both worlds.

★ Flexdashboard ★

★ ★ Shiny ★ ★

★ ★ ★ Flexdashboard-Shiny ★ ★ ★

Flexdashboard types are rendered as an HTML document—simple websites—, and can therefore be easily published on personal sites or RPubs. This is convenient because no special hosting is required. In contrast, Shiny and Flexdashboard-Shiny types offer greater features, but require Shiny servers. Fortunately, the shinyapps.io server is available for free, up to some usage limit. This server can host any of the three dashboards mentioned here. Another good option is presented by Binder environments, which can host the Shiny-type dashboards with no (explicit) limit. Yet, the Flexdashboard-Shiny type cannot be hosted in this server (as of January 2020, at least). Consequently, greater functionality may come at a cost for dashboards that have any considerable traffic, whereas dashboards with low traffic may do well on shinyapps.io. Knowing these trade-offs can help navigate usage limits, save on web hosting fees, and increase the availability of our dashboards online, as we can offer fall-back versions on different platforms, as in the example below:

... preferred-dashboard (in case of downtime, please visit this alternative)

Transforming dashboards into the different versions can be as easy as enabling or disabling some features, especially input reactivity. For instance, if we want to downgrade a Flexdashboard-Shiny to a Flexdashboard, to publish it outside of a Shiny server (see example), we must add a setting in the header of the script

knit: (function(inputFile, encoding) { rmarkdown::render(inputFile, encoding = encoding) })

and disable reactive features

```{r}# Number of words selected on sidebar# reactive(cat(paste0('Words selected below: ', nrow(selected_props()))))```
Free accounts and tips

App providers have specific terms of use. To begin, shinyapps.io has a free starter license with limited use, where free apps can handle a certain amount of data, and up to five apps may be created. Beyond that, RStudio offers a wide range of subscriptions starting at $9/month.

Memory and traffic limits of the free shinyapps.io account can sometimes present problems when heavy data data sets are used, or there are many visits to the app. The memory overload issue is often flagged as Shiny cannot use on-disk bookmarking, whereas excessive traffic may see the app not loading. Fortunately, usage limits need not always require a paid subscription or a custom server, thanks to the following workarounds:

- develop app locally as far as possible, and only deploy to shinyapps.io only at the last stage;

- prune data set, leaving only the necessary data;

- if necessary, unlink data by splitting it into different sets, reducing computational demands;

- if necessary, use various apps (five are allowed in each free shinyapps.io account);

- if necessary, link from the app to a PDF with visualisations requiring heavy, interlinked data. High-resolution plots can be rendered into a PDF document in a snap, using code such as below.

``` pdf('List of plots per page', width = 13, height = 5) print(plot1) print(plot2) # ... print(plot150) dev.off() ```

Conveniently, all text in a PDF—even in plots—is indexed, so it can be searched [ Ctrl+f / Cmd+f /  ] (see example). Furthermore, you may also merge the rendered PDF with any other documents.

Event (Workshop)

TitleWorkshop 'Data dashboards and Binder environments', co-organised with N8 CIR
CountryUnited Kingdom
Degree of recognitionNational event