I need to setup a reporting document in which I loop over items and generate individual graphs. when using R in jupyter i read about display_markdown and display_html using repr and IRDisplay here: How to render LaTeX / HTML in Jupyter (R)? This perfectly does the job of printing Markdown inside a code cell. but unfortunately the order is ruined.
If i do:
library(IRdisplay)
library(repr)
options(repr.vector.quote=FALSE)
for (i in 1:3) {
print(paste("print before headline in run:",i))
display_markdown(paste("# Headline in run:",i))
cars <- c(i, 3, 6, 4, 9)
plot(cars)
print(paste("print after headline in run:",i))
}
the end result in jupyter gets mixed up. the headlines appear above the printed lines and graphs:
R version 3.2.2 (2015-08-14)