Extreme Rmarkdown report automation with parameters and templates
Channel: Bruno Rodrigues
Date: 2022-04-07

A continuation of a previous video (https://www.youtube.com/watch?v=R7WiF2Vcb2o) in which I discuss how to run parametrized Rmarkdown document. This will allow you to write a single .Rmd file and then generate potentially 100's of output documents by looping over a list of countries, cities, companies etc... so in the end you will have the same report, one for each country/city/company!
The other trick I show you, is how to use knit_child(), a function that generates Rmarkdown code; so if you need to, let's say, generate one section per variable in your dataset, with a plot and a table, you can loop over the variables and knit_child() will generate the Rmarkdown for you.
A bit complex, but definitely worth it! 

Here are the scripts used in the video:

https://gist.github.com/b-rodrigues/ed62c86060c5f1901c8299a98fe44191

More documentation on knitr::knit_child(): https://bookdown.org/yihui/rmarkdown-cookbook/child-document.html

Read my blog: https://www.brodrigues.co

Buy me a coffee, my kids don't let me sleep:
https://www.buymeacoffee.com/brodriguesco

Learn R by reading my free ebook: https://b-rodrigues.github.io/modern_R/