【发布时间】:2017-01-26 12:57:18
【问题描述】:
我在R notebook 工作,想用它来创建两个输出:HTML 文档和 PDF 文档。
我的分析包括传单地图(html 小部件),这在我将笔记本编入 PDF 文档时会导致问题。感谢webshot 函数现在包含在knitr 包中,“knitr 将尝试使用 webshot 包自动为 HTML 小部件生成静态屏幕截图”(https://github.com/yihui/knitr/blob/master/NEWS.md)。
当我的输出是一系列堆叠在一起的传单地图时,这很好用,但我想以更简洁的行排列将这些地图组合在一起(见下图)。
这是我的 R 笔记本的可重现示例:gist
不幸的是,当我尝试将其编入 PDF 文档时,我收到以下错误消息:
Error: Functions that produce HTML output found in document targeting latex output.
Please change the output type of this document to HTML. Alternatively, you can allow
HTML output in non-HTML formats by adding this option to the YAML front-matter of
your rmarkdown file:
always_allow_html: yes
Note however that the HTML output will not be visible in non-HTML formats.
如何在 PDF 文档中获得这种单行排列?
【问题讨论】:
标签: r leaflet knitr r-markdown htmlwidgets