0

I am using R Markdown to create an HTML presentation (specifically, where output is slidy_presentation). I am trying to write a loop to print a set of charts per country, with a new page for each set. However, I'm having trouble inserting the page break. All the guides I have seen refer only to how to create a page break if generating a PDF (variants of using cat("\n\\newpage\n"), and also specifying {r results = "asis"}), but this doesn't work if I'm generating HTML for Slidy. Alternatively, if I try to use cat("##") to output the code used in R Markdown for a newpage, I also don't get the right result.

Are there any suggestions on how I can write this loop?

1 Answers1

1

I've done

for(i in some_vector){
    cat("\n\n## slide title: ", i, "\n")
    more code...
}

and that works for me

r.bot
  • 5,309
  • 1
  • 34
  • 45