tests/testthat/examples/knitr-examples/041-label-i.md

My report

data(mtcars)

This example shows how to generate chunk labels dynamically with the brew syntax. It was motivated by the SO question: http://stackoverflow.com/q/12095113/559676

Generate report for each level of cylinder variable

6

hist(mtcars$mpg[mtcars$cyl == 6], main = paste(6, "cylinders"))

plot of chunk mpg-histogram-6

hist(mtcars$wt[mtcars$cyl == 6], main = paste(6, "cylinders"))

plot of chunk weight-histogam-6

4

hist(mtcars$mpg[mtcars$cyl == 4], main = paste(4, "cylinders"))

plot of chunk mpg-histogram-4

hist(mtcars$wt[mtcars$cyl == 4], main = paste(4, "cylinders"))

plot of chunk weight-histogam-4

8

hist(mtcars$mpg[mtcars$cyl == 8], main = paste(8, "cylinders"))

plot of chunk mpg-histogram-8

hist(mtcars$wt[mtcars$cyl == 8], main = paste(8, "cylinders"))

plot of chunk weight-histogam-8



Try the parsermd package in your browser

Any scripts or data that you put into this service are public.

parsermd documentation built on Aug. 21, 2025, 5:27 p.m.