Since its introduction in 2012, Shiny has become a mainstay of the R ecosystem, providing a solid foundation for building interactive artifacts of all kinds. But that interactivity has always come at a significant cost to reproducibility, as actions performed in a Shiny app are not easily captured for later analysis and replication. In 2016, Shiny gained a “bookmarkable state” feature that makes it possible to snapshot and restore application state via URL. But this feature, though useful, doesn’t completely solve the reproducibility problem, as the actual program logic is still locked behind a user interface.
The solution that Shiny app authors have long requested is a way for users of their apps to explore interactively, and then generate a reproducible artifact—like a standalone R script or R Markdown document—that represents a snapshot of the app’s state and logic. Such a script can then be rerun, studied, modified, checked into source control—all the things one cannot do with an interactive app. Such script-generating Shiny apps do exist today, but it is generally thanks to heroic efforts on the part of their authors; the level of implementation effort is high, and the Shiny app logic tends to be fragile and/or involve significant duplication of code.
In this talk, I’ll discuss some of the approaches that app authors have taken to achieve these ends, along with some surprising and exciting approaches that have recently emerged. These new approaches usefully decrease the implementation effort and code duplication, and may eventually become essential tools for those who wish to combine interactivity with reproducibility.