I'm working on the report using {bookdown} package. I'm using "Knit and Merge" rendering approach to knit each .Rmd in fresh session. The problem, I'm facing, is how to use parameters that I set in yaml header of index.Rmd, in the all chapters?
You should be able to declare your parameters at the top-level of the YAML header in your index.Rmd file (or your _output.yaml file, if used), such as:
I've thought it should be so. However, setting params in the index.Rmd works only for the rendering book with the "merge and knit" approach. Probably because with "knit and merge" each .Rmd knitted in a fresh session the params from the index header also get washed away.
I've just tried to put params in _output.yml, but I can't make it work in both rendering approach. In minimal book example I've added params to _output.yml and call it in index.Rmd. Build is stopped with error.
This is _output.yml with 3 last lines added by me + I changed link title from "A Minimal ..." to "My Minimal..." just to confirm that file is actually accessed during the build.
As a workaround, I've created a .R file with all the params that I initially had in yaml header and then source this file at the first chunk in each .Rmd (put it in template, of course). The result is the same as with yaml header in "merge and knit" rendering but need a couple extra steps.
Hope it can be somehow fixed in the future releases of {bookdown}.