KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to iterate over a list of result-sets in my R markdown file. When I produce the output I want to include some text like headers with the name of the result set. One hacky solution I have found is to hardcode the html output directly in the documentation like this ## All results ```{r loopResults, echo=FALSE, results='asis'} results = list(result1 = data.frame(x=rnorm(3), y=rnorm(3)), result2=data.frame(x=rnorm(3), y=rnorm(3))) for(res in names(results)) { cat(paste("<h3>Results for: ", res, "</h3>>")) plot(results[[res]]$x, results[[res]]$y) } This doesn't seem to be the right way to do things, especially since I want to create PDF documents via pandoc at time and would have to change the hard-coded expressions. (I have currently convenience functions like h3(text, type)). Is there a better way of doing this?
Tags (comma-separated)
Save Edits
Cancel