I am generating Rmd files using a function and as part of that, I'd like to set some of the yaml fields to fixed values but that are parameterised. I'm not sure that's a particularly clear way to put it, so I'll proceed with an example:
I have a function that generates an Rmd from a template like so:
library(mypackage)
new_notebook("Sales analysis", author = "Ben")
#> Created sales-analysis.Rmd
Where new_notebook calls rmarkdown::draft inside the function body, and sales-analysis.Rmd looks something like:
---
title: "Untitled"
author: "Set name here"
---
# Overview
# Analysis
Ideally, I'd like to be able to set the values in the yaml header of sales-analysis.Rmd to fixed, parameterised values. That is, something like:
---
title: "Sales analysis"
author: "Ben"
---
...
Is there an easy way to acheive such a thing?