R knitr Markdown: Output Plots within For Loop

Wrap the qplot in print.

knitr will do that for you if the qplot is outside a loop, but (at least the version I have installed) doesn’t detect this inside the loop (which is consistent with the behaviour of the R command line).

Leave a Comment