Chapter 5. Workflow

If you’re going to be writing a lot of Shiny apps (and since you’re reading this book, I hope you will be!), it’s worth investing some time in your basic workflow. Improving workflow is a good place to invest time because it tends to pay great dividends in the long run. It doesn’t just increase the proportion of your time spent writing R code, but because you see the results more quickly, it makes the process of writing Shiny apps more enjoyable and helps your skills improve more quickly.

The goal of this chapter is to help you improve three important Shiny workflows:

  • The basic development cycle of creating apps, making changes, and experimenting with the results.

  • Debugging, the workflow where you figure out what’s gone wrong with your code and then brainstorm solutions to fix it.

  • Writing reprexes, self-contained chunks of code that illustrate a problem. Reprexes are a powerful debugging technique, and they are essential if you want to get help from someone else.

Development Workflow

The goal of optimizing your development workflow is to reduce the time between making a change and seeing the outcome. The faster you can iterate, the faster you can experiment and the faster you can become a better Shiny developer. There are two main workflows to optimize here: creating an app for the first time and speeding up the iterative cycle of tweaking code and trying out the results.

Creating the App

You will start every app with the same six lines ...

Get Mastering Shiny now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.