Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
use knit() with a loop to write reports for subsets of data
<<run-all, results='hide', message=FALSE>>=
out = NULL
for (g in unique(mtcars$gear)) {
out = c(out, knit_child('template.Rnw', sprintf('gear-%s.tex', g)))
<<write-results, echo=FALSE, results='asis'>>=
cat(out, sep = '\n')
<<include=FALSE, cache=FALSE>>=
# make sure figure paths do not collide
opts_chunk$set(fig.path = paste('figure/gear', g, sep = ''))
\section{Cars with \Sexpr{g} gears}
df = subset(mtcars, gear == g, 1:5)
print(xtable(df), floating = FALSE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.