gpt4 book ai didi

r - 在knitr中指定多个同时输出格式(新)

转载 作者:行者123 更新时间:2023-12-03 01:16:37 26 4
gpt4 key购买 nike

我可以编写 YAML header 来使用 knit 为 R Markdown 文件生成多种输出格式吗?我无法重现 the original question with this title 的答案中描述的功能.

此 Markdown 文件:

---
title: "Multiple output formats"
output:
pdf_document: default
html_document:
keep_md: yes
---

# This document should be rendered as an html file and as a pdf file

生成 pdf 文件,但不生成 HTML 文件。

这个文件:

---
title: "Multiple output formats"
output:
html_document:
keep_md: yes
pdf_document: default
---

# This document should be rendered as an html file and as a pdf file

生成 HTML 文件(和 md 文件),但不生成 pdf 文件。

后一个示例是给 original question 的解决方案。我尝试过使用 Shift-Ctrl-K 和 RStudio 中的 Knit 按钮进行编织,以及调用 rmarkdown::render ,但无论我使用哪种方法,都只创建了一种输出格式生成输出文件。

可能相关,但我无法确定解决方案:

使用 R 版本 3.3.1 (2016-06-21)、knitr 1.14、Rmarkdown 1.3

最佳答案

我实际上在 Render all vignette formats #1051 中简要提到过你错过了:

rmarkdown::render('your.Rmd', output_format = 'all')

它记录在帮助页面?rmarkdown::render上。

关于r - 在knitr中指定多个同时输出格式(新),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44685485/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com