📄📄📄 Autofill an R Markdown document with a loop, rendering to .docx with a style template (featuring Dawson's Creek data)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
data
output
style
.gitignore
01_template.Rmd
02_loop.R
LICENSE
README.md
mail-merge-2018.Rproj

README.md

mail-merge-2018

This repository supports the blog post 'Mail Merge in 2018 in R': https://www.rostrum.blog/2018/06/26/mail-merge/

TL;DR

You need to populate a .docx (or .html or .pdf) template hundreds of times. Automate this with R, R Markdown, a style document and knitr.

Purpose

With beginner R users from my department in mind, this repository contains files that:

  • create an R Markdown template to be filled with data
  • use a loop to fill the template with data for each row of your tidy dataset in turn
  • render the template to .docx format with reference to a style template

The data used here are from the Wikipedia entry for Dawson's Creek episodes.

To download

Click the green button 'Clone or download' and then 'Download ZIP'. After unzipping, open the .Rproj file.

Or clone with git clone https://github.com/matt-dray/knitting-club.git.