Reproducing user actions as code in Shiny