I posted this on StackOverflow but have no replies yet, so I'm asking here too.
I have a for loop in R, inside of which I want to create R Markdown section headers and print output from R functions such as summary(lm(...)). If I use {r results='asis'} at the start of the code chunk, I can get the section headers to work but the R output won't display properly. If I don't use results='asis' then the R output displays but the section headers won't work. How can I get R-created section headers and R output is the same code chunk, all inside a for loop? There's a complete example R Markdown script and output over at the Stack Overflow post. Thanks!