Shiny Applications

R does not run natively in a web browser, but it has many native and user-contributed entry points to exchange objects with other languages. The Shiny package from RStudio allows R and javascript to exchange objects, which, along with a host of R functions to build HTML inputs, is enough to create web forms that run sophisticated server-side code to create visuals or perform complex analyses. There are also options to create custom client-side code to customize messages from the server to the UI, or vice-versa.

Here are a few public applications I've recently completed. The titles and images link to live applications; if I am self-hosting them and they do not load, I am probably out of time in my account. Send me a note and I'll make sure you can explore them.

An interactive survey to gather expert opinion on species occurrence at a number of points.

Experts log in, respond to questions about their expertise, then offer opinions on species presence at a number of locations.

To browse this app as a guest, login with the username "guest."

This app is shared by three projects, so there is a separate private app that allows each project's principal investigator to customize the survey and download responses. Customization includes the ability to:

  • Upload points
  • Change the number/type/content of each survey question
  • Rename variables
  • Add/remove experts
  • Add/remove features. Some features include:
    • Fixed or random starting values
    • Ordered or random point presentation
    • Multiple distributions (beta, poisson, normal), a simple number line, or a likert selector
    • Supplemental imagery/graphics
    • Variable number of points

The survey parameters and expert responses are stored in a mongoDB (no-SQL) database hosted at mlab.com*. Project PIs upload locations as a shapefile containing either polygons or points; persistent file storage for the shapefile is via an AWS S3 storage bucket.

*I have also used AWS RDS as a relational database back-end for other apps.

Multiple-criteria decision analysis is a decision strategy that offers transparency to the process of integrating input from a variety of stakeholders. This app was designed to visualize how various strategies to restore natural tidal flows to an estuary on Cape Cod, Massachussets will affect residents, the local economy, and local areas with historic or scenic value. The goal is to maximize the benefits of natural tidal flow such as flood control, improved wildlife habitat, and reduced management costs while minimizing negative impacts such as sediment movement, stagnant water, or vegetation mortality due to floodplain inundation. The app is driven by two csv files of parameters and a series of prediction files, all uploaded at the start of the process (sample csv files can be downloaded in using the menu in the upper right). The full analysis can be saved so that it may be re-visited in the future without re-parameterizing the entire app. The app also produces a variety of graphics to inform management or support the decision making process. Persistent file storage for this app is on Google Drive, which is free and convenient due to the web-editing capability.

To ensure you can see the final graphs, here are brief instructions for use:

  1. Download and extract the sample data using the menu at the top right.
  2. Upload "Policies.csv" as the policy file. Under "Group/Name Policies" down below, enter a 1 in the "Group" row for both the right-most columns ("P_Sed1" and "P_Sed11") to indicate they are members of a group. Leave all other fields in the "Group" row blank. Enter a 1 in the "Allocation" row under P_Sed1, and 11 in the "Allocation" row under P_Sed11. Leave all other fields in the "Allocation" row blank.
  3. Upload "Attributes.csv" as the attribute file.
  4. Upload one or both "EE_Predictions_Tim.csv" and "EE_Predictions_Eric.csv" as expert prediction files.
  5. Upload "models_LOOKUP.csv" and "models_INTERP.csv" as model prediction files.
  6. View the "Group Objectives" tab (no need to change anything, but it must be viewed)
  7. View the "Prediction Sources" tab (no need to change anything, but it must be viewed)

I am self-hosting this app during development, but it will be hosted by the client on completion. If it doesn't load I may have run out of time on my free shinyapps.io account. Drop me an email and I'll send you an active link to a functional app.

Making data public, and publicly explorable. The researcher who commissioned this app was required by his grant to make the data publicly accessible. I like how the data subsetting is presented on-screen, where options that are not present in the data are shown in gray (see lower checkboxes in image at left). Data subsetting is day-one stuff in R, but somehow it was not intuitive to display the relative contents of the subset compared to the entire dataset in an interactive setting. I posted a few notes about this in my short blog.

An interactive calculator. This app is a calculator for computing the volume of methane biogas produced by controlled digesters. It is essentially a web interface for the R package biogas by Sasha Hafner et al. This package, and this app, are proving to be essential tools for members of the biofuel industry, particularly in Europe.