Skip to content
🐈 Demo: iterative rendering of {xaringan} slides with params using {purrr}
R
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
src
.gitignore
README.md
ninja-knitting.Rproj

README.md

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.

You can’t perform that action at this time.