


The basic premise here is that you can use a single R script to “drive” the rendering of your R Markdown file. My solution borrows from the posts above.
R MARKDOWN TABLE HOW TO
Another seems more relevant to my workflow (since I’m using R Markdown rather than Sweave) but explains how to create multiple reports from a single data set. One describes a similar problem, but in terms of knitr with Sweave. There are several Stack Overflow posts that speak to this issue. Each PDF would be based on data from each file. Instead I started looking around for ways to loop through a list of files and generate multiple PDF reports. So the process above wasn’t going to work for me.

I encountered this problem when I was trying to automate a workflow for generating reports on publication data. That is, a group of PDFs or HTML files with common R code (and therefore common report features, like figures, tables, summary statistics, etc.) executed dynamically on different data sets. Until recently I had yet to run into a scenario where I needed to use R Markdown to produce a “templated” set of reports.
