Steph Locke shows how to use the params section of a YAML header to enable parameter reuse:
You may already know the trick about making the date dynamic to whatever date the report gets rendered on by using the inline R execution mode of rmarkdown to insert a value.
--- title: "My report" date: "`r Sys.Date()`" output: pdf_document ---
What you may not already know is that YAML fields get evaluated sequentially so you can use a value created further up in the
params
section, to use it later in the block.
Click through to see how it’s done.