Chapter 15 Parameterized reports

One of the many benefits of working with R Markdown is that you can reproduce analysis at the click of a button. This makes it very easy to update any work and alter any input parameters within the report. Parameterized reports extend this one step further, and allow users to specify one or more parameters to customize the analysis. This is useful if you want to create a report template that can be reused across multiple similar scenarios. Examples may include:

  • Showing results for a specific geographic location.

  • Running a report that covers a specific time period.

  • Running a single analysis multiple times for different assumptions.

  • Controlling the behavior of knitr (e.g., specify if you want the code to be displayed or not).

In this chapter, we discuss the use of parameterized reports, and explain how we can interactively define the parameters to compile the results.