Skip to content

Latest commit

 

History

History
27 lines (16 loc) · 1.88 KB

README.md

File metadata and controls

27 lines (16 loc) · 1.88 KB

ninja-knitting

Blog post

What

You want to use R to generate multiple reports from a single template, each containing different data.

How? Create a parameterised RMarkdown template with a params YAML argument. Iterate over param values with rmarkdown::render() inside purrr::map().

This repo contains a demo of the approach that focuses on parameterised {xaringan} slides. It includes a further {purrr} step with pagedown::chrome_print() to render the HTML outputs to PDF.

Contents

docs/ contains:

  • a parameterised RMarkdown report template (ninja-knitting-template.Rmd)
  • resources (libs/ and styles/)
  • rendered HTMLs (one for each parameter passed to the template)
  • rendered PDFs (one for each HTML)

src contains one R file, 00-run.R, that:

  1. Iterates over the RMarkdown template with different param variables to produce HTML reports
  2. Iterates over the HTML reports to render them to PDF

Read more on the associated blog post.