RTI International is a registered trademark and a trade name of Research Triangle Institute. www.rti.org

Designing, building, and deploying an 

interactive survey monitoring 

dashboard using R Shiny

Joe Murphy, Michael Duprey, Rob Chew

1

Government Advances in Statistical Programming Workshop

October 24-25, 2018, Bureau of Labor Statistics
Acknowledgements

▪ Examples for this presentation come from the National 

Longitudinal Study of Adolescent to Adult Health (Add Health)

▪ Add Health is funded by the Eunice Kennedy Shriver National 

Institute of Child Health and Human Development and 

conducted by the University of North Carolina Population 

Center in partnership with RTI International.

▪ Data presented here do not reflect actual Add Health 

estimates. The data were perturbed in many examples to 

protect the confidentiality of the study participants.

2
Summary

3

Presentation outline

▪ Motivation

▪ Static visualizations

▪ Interactive visualizations 

▪ R and Shiny

▪ Structure (code, data, taxonomy)

▪ Deployment and hosting

▪ Benefits

▪ ATD Dashboard demo

▪ Next steps
Motivation

▪ How best to define “success” metrics

▪ How best to track progress toward project-defined goals

– response rate

– budget

– schedule

▪ How to simultaneously monitor multiple (case / interviewer / 

data) management systems

▪ How to interpret reams of tabular data which may obfuscate 

trends or patterns

4

Challenges in complex survey management 
Motivation

▪ Process to identify and monitor key features of a survey 

design that are critical to data quality

▪ Similar to responsive design and adaptive design

▪ Regular monitoring of data

▪ Goal of ATD is to minimize total survey error and costs

▪ Allocates resources to maximally control errors and costs

5

Adaptive Total Design (ATD)
Motivation

▪ Start with “what metrics are key to the success of our survey?”

▪ Determine what other factors might affect that success

▪ Generate a plan for regular (real-time / hourly / daily) 

monitoring of data

▪ All this is important if:

– Your goal is to minimize total survey error and costs

– You need to determine if / when interventions will be applied

– You need to assess and project the outcomes of experiments 

during data collection

6

Continuous Quality Monitoring
Motivation

▪ Visualizations enable certain data to be compressed, rapidly interpreted, and easily distributed

7

Data visualization: critical tool
Static visualizations: response rates by mode protocol

8 SOURCE: Murphy, Biemer, and Berry, 2016
Static visualizations: response rates by mode protocol

9

▪ Limit number of lines

▪ Use patterns for black / white printing

SOURCE: Murphy, Biemer, and Berry, 2016
Static visualizations: response rates by mode protocol

10

Simple, readable axes and legends

SOURCE: Murphy, Biemer, and Berry, 2016
Static visualizations: response rates by mode protocol

11

Maximize the data-ink ratio

(proportion of ink used to show data)

SOURCE: Murphy, Biemer, and Berry, 2016
Interactive visualizations

▪ Allow users to create custom views

▪ Enable ability to subset data, modify display (pan, zoom, 

hover), and export views

▪ Flexibly incorporate disparate input data (e.g., survey level, 

respondent level, interviewer level)

▪ Provide web hosting for project and client teams

▪ Provide quick and easy setup for projects

▪ Minimize user burden at every step

12

Goals
Interactive visualizations

▪ Custom-built visualization platform programmed in R and 

Shiny: ATD Dashboard

▪ Shiny is an R package that provides a high-level language 

for web application development; avoids explicit HTML / 

CSS / JavaScript programming

▪ Can leverage robust set of packages from the R community; 

easily incorporate modeling

▪ Allows for hosting behind secure firewall with Shiny Server

▪ Open source and free platform (cf. Tableau)

13

Solution
ATD Dashboard

14

▪ Details logic and analyses 

(functions)

▪ Generates warnings (passed to UI)

▪ Produces plots

Shiny application code architecture

Server

▪ Interacts with server file

▪ Details, displays, and 

dynamically updates UI, 

depending on a user’s selections

▪ Displays warnings

User Interface (UI)

▪ Implemented in R; however, users do not need to interface with the 

underlying code

▪ Reactive components (observe and report)
ATD Dashboard

15

▪ Input data in flat-file format (csv 

file)

▪ Long (stacked) data

▪ Metadata information included in 

“blocked” sections at file head

– Block for critical dates (axis markers)

– Block for data taxonomy

Example data

▪ Format consist of five

columns

– Study name: study

– ID: id

– Variable name: var

– Value: val

– Date/time-stamp: dt

study id var val dt

... ... ... ... ...

Add Health Wave V Sample 2a 5237119 Device Type PC 20-Mar-17

Add Health Wave V Sample 2a 5237674 Device Type PC 17-Mar-17

Add Health Wave V Sample 2a 5237765 Device Type Mobile 17-Mar-17

Add Health Wave V Sample 2a 5237981 Device Type Mobile 27-Mar-17

Add Health Wave V Sample 2a 5238472 Device Type Mobile 15-Mar-17

... ... ... ... ...

Data structure
ATD Dashboard

16

Level

ind (indicator)

cat (categorical)

num (numeric)

cnum (cumulative numeric)

Stage Type

▪ Provides compact attribute vocabulary, easy to input into flat file

▪ Provides mechanism to limit UI selection options to only logical 

combinations

and invoke variable mathematical operations

▪ Mapped to data in csv file

Data taxonomy

pre (preload)

out (outcome)

sub (subset and outcome)

all (all units)

Unconstrained value:

samp (sample)

int (interviewer)

event (event)

samp_out_cat

Type-class system

(Device Type)
ATD Dashboard

17

Static mapping

Map

Data

study id var val dt

Add Health Wave V Sample 2a C:Undeliverables samp_out_ind

Add Health Wave V Sample 2a C:Completion Mode samp_out_cat

Add Health Wave V Sample 2a C:Device Type samp_out_cat

Add Health Wave V Sample 2a C:Self R. Health: Excellent samp_out_cat

Add Health Wave V Sample 2a C:Self R. Health: Fair samp_out_cat

Add Health Wave V Sample 2a C:Undeliverables samp_out_ind

... ... ... ... ...

study id var val dt

... ... ... ... ...

Add Health Wave V Sample 2a 5237119 Device Type PC 20-Mar-17

Add Health Wave V Sample 2a 5237674 Device Type PC 17-Mar-17

Add Health Wave V Sample 2a 5237765 Device Type Mobile 17-Mar-17

Add Health Wave V Sample 2a 5237981 Device Type Mobile 27-Mar-17

Add Health Wave V Sample 2a 5238472 Device Type Mobile 15-Mar-17

... ... ... ... ...
ATD Dashboard

18

Static mapping

UI drop-down options reactively updated to allow 

logical combinations, conditioned on prior selections

Data taxonomy

Select primary outcome of interest

samp_out_cat

Choose plot type

Filter to subset

(e.g., samp_sub_ind)

Filter to (second) subset

Separate outcome 

into categories

samp_out_cat
Shiny Server

Deployment and hosting

19

▪ Apps deployed with RStudio Shiny Server, hosted on local 

or remote computers

▪ Can be deployed to the web or shared within a closed 

network behind a firewall with authentication for site access

▪ For reproducibility and to aid in future deployment to other 

servers, both R Shiny Server and an NGINX web server 

(used as a reverse proxy to redirect requests) were 

configured and deployed in Docker containers 
ATD Dashboard Examples

20
21
22
23
24
Conclusion

– Internal users: continual monitoring of data collection helpful 

for discussions related to production goals and strategies 

within the current sample (i.e. use of and timing of additional 

mailings)

– External users: format of “everything on a page” found to be 

useful to get up to speed with the current results at a glance 

and be prepared to discuss implications for the design of 

future samples with the internal team

25

Reception
Conclusion

26

▪ At the beginning of a study, it can be a challenge to define the 

key metrics for data collection

▪ More flexibility in monitoring and planning for future sample 

releases 

▪ Many potential metrics and narrowing it down can be difficult

▪ Having the dashboard and needing to decide what to monitor 

spurred conversations about goals that might not otherwise 

have taken place

Impact
Conclusion

27

Summary of benefits

▪ Ability to monitor survey in near real time for decision making

▪ Only most important information (not reams of tables) displayed

▪ Leverages best practices in graphic design

▪ Non-programmer team members can gain insights from data; clients can 

interact with data directly

▪ No licenses required for individuals

▪ Codebase is reusable, easily transportable

▪ Codebase is easily extensible, thanks to R

▪ Dashboards can be shared across organization, avoiding costly licensing fees

Next steps

▪ Incorporate weighted data and statistical tests

▪ Pull-up data tables

▪ Allowing multiple layers of graphs
Thank you!

Joe Murphy

jmurphy@rti.org

28

Contact