Downloading code to reproduce analysis within shiny app


#1

Hi all,

I have a multi-page navbar style app for exploratory data analysis. I would like to add an action button which will then display R code that can be downloaded to reproduce the outputs generated within the Shiny app to continue working on interesting findings.

For a single output with limited dependencies I think it’s reasonably straightforward to reconstruct the code using paste or glue to generate a character string. However, the data flow across the app from initial data selection, manipulation, summarising and reporting spans across a few panels/pages is dependent on many inputs, and passes through some shiny modules. I have the impression that there must be a more sophisticated strategy to reconstruct the code than what I am currently trying to do. Does anyone have any clever tips or suggestions for this?

Since the path to the outputs that I want to get the code for is not a fixed linear route through the app, I don’t think that I can define some parametrised markdown report to achieve what I need.