R Studio Table Contest 2022 Entry
This is my entry into the R Studio 2022 Table Contest. It uses Tplyr, reactable, shiny and Quarto to present an insights dashboard for clinical trial data analysis.
You may view it here.
Here is a preview of the dashboard. Click to view to a higher resolution video version.
My aims for this project were two-fold:
-
Investigate whether we can dynamically create tables which can be used to guide an exploratory analysis.
The analysis starts with an anchor table, where individual cells can be clicked to retrieve the study participants ID's who comprise it. These are subsequently fed into additional tables, listings and figures through reactives.
In previous work, I've hard coded the anchor table by pre-specifying the variables to be displayed. With this work, you can now dynamically specify the anchor table to include any variables you like, which in turn can be used explore subgroups on-the-fly.
This work is largely enabled by utilizing the metadata building features of the Tplyr package. -
Currently, no dashboard extension or package exists for Quarto. I used this opportunity to also see if I could (roughly) mimic what
flexdashboard
offers by using Quarto and custom css. My inspiration was the bootswatchlux
theme.
The linked TLFs are also interactive and share the spirit of "drilling down" and exploration
- Uses
reactable
's groupBy to succinctly present a large table - Cells (in the second column) are hyper-linked to open a MedlinePlus search of that term. I found this resource was helpful in learning about medical conditions when analyzing clinical trials data.
- A table-wide search functionality to pin-point certain SOCs/PTs of interest
- A button to expand all SOCs at once to show the nested PTs
- The
highcharter
column chart is a drill down plot. The first layer displays the top 4 System Organ Classes for a given subset - Clicking each of bars lets you drill down into a stacked column chart for the Preferred Terms x Severity
- Customized tool tips to display information more clearly (i.e. severity of adverse event)
- It's a visual representation of the adverse event linked table, but could be extended to show other data views too
- Uses
reactable
's filter + search to navigate a potentially exhaustive table - Leverages
reactable
's columnGroups + formatting to organize the data layout - Capable of exporting a list subject identifiers as a CSV file to enable further analyses of interesting subgroups
- Uses
reactablefmtr
's inline visual to show vital signs measured at three times relative to baseline (i.e. percent change) - Leverages
reactable
's columnGroups + formatting to organize the data layout - Paired with shiny inputs to enable switching of Blood Pressure Parameters and Visits
For this project, I've used renv
so that you may recreate this in an offline setting.
While there are many ways to structure this dashboard, I chose not to experiment with modules and and keep things simple until a proper dashboard extension or framework for Quarto is released. I've instead isolated key parts of the code into their own server chunks
with comments for ease of review.
The data for this example comes from the TestDataFactory repository operated by phuse. This data is not stored in the app deployment or my code repository - it is accessed directly from the source repository.
This app can be extended in a number of different ways:
- Including additional, linked TLFs; the sky's the limit!
- Uploading data functionality - the way I've began to structure the server will enable this in the future (i.e. using renderUI)
- More robust organization, control and validation for when the anchor table is updated