简体   繁体   English

在R Markdown for HTML发布中创建循环的分页符

[英]Creating looped page breaks in R Markdown for HTML publication

I am using R Markdown to create an HTML presentation (specifically, where output is slidy_presentation). 我正在使用R Markdown创建HTML演示文稿(特别是在输出为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. 我所见过的所有指南仅涉及生成PDF时如何创建分页cat("\\n\\\\newpage\\n")使用cat("\\n\\\\newpage\\n")变量,并指定{r results = "asis"} )),但是如果我为Slidy生成HTML,则此方法不起作用。 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. 另外,如果我尝试使用cat("##")为新页面输出R Markdown中使用的代码,我也不会得到正确的结果。

Are there any suggestions on how I can write this loop? 关于如何编写此循环,有什么建议吗?

I've done 我弄完了

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

and that works for me 那对我有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM