Using spineplot in R, I am trying to create a series of graphs that compare some potential covariates with age categories, so we can conduct a preliminary exploration of the data. I have this code written in R Markdown, and I use RStudio to insert the file into the HTML output. However, itโs hard for me to get every plot created by my loop to have the corresponding RMarkdown title. I tried putting cat("## my header") in a loop that produces each plot, but for some reason it appears only for the first plot, and not for the rest. It prints for the rest of them, but is not interpreted as Markdown.
Here is an example of my code:
--- title: "Minimal Working Example" author: "TARehman" date: "Wednesday, August 27, 2014" output: html_document: toc: yes ---
The result is as follows.

source share