在knitr中指定多种同时输出格式(新) [英] Specifying multiple simultaneous output formats in knitr (new)
问题描述
我可以编写YAML标头以使用knitr为R Markdown文件生成多种输出格式吗?我无法复制答案与此标题相同的功能中所述的功能.
Can I write a YAML header to produce multiple output formats for an R Markdown file using knitr? I could not reproduce the functionality described in the answer for the original question with this title.
此降价文件:
---
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文件.
produces a pdf file but no HTML file.
这个文件:
---
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文件.
produces an HTML file (and an md file) but no pdf file.
后一个示例是针对原始问题的解决方案.我已经尝试过使用Shift-Ctrl-K和RStudio中的编织"按钮进行编织,以及调用rmarkdown::render
,但是无论我使用哪种方法生成输出文件,都只会创建一种输出格式.
This latter example was the solution given to the original question. I have tried knitting with Shift-Ctrl-K and with the Knit button in RStudio, as well as calling rmarkdown::render
, but only a single output format is created, regardless of the method I use to generate the output file.
可能相关,但我无法确定解决方案:
Possibly related, but I could not identify solutions:
- 如何以多种方式生成R包渐晕格式?
- 呈现所有小插图格式#1051
- knitr :: pandoc无法使用单个配置#769创建pdf和tex文件
- pandoc#547的多种格式
- 三岁的RStudio博客文章
- How do I produce R package vignettes in multiple formats?
- Render all vignette formats #1051
- knitr::pandoc can't create pdf and tex files with a single config #769
- Multiple formats for pandoc #547
- An allusion to multiple output format support in a three year old RStudio blog post
使用R版本3.3.1(2016-06-21),knitr 1.14,Rmarkdown 1.3
Using R version 3.3.1 (2016-06-21), knitr 1.14, Rmarkdown 1.3
推荐答案
我实际上在渲染所有小插图格式#1051 ,而您错过了它:
I actually briefly mentioned in Render all vignette formats #1051 and you missed it:
rmarkdown::render('your.Rmd', output_format = 'all')
它记录在帮助页面?rmarkdown::render
中.
这篇关于在knitr中指定多种同时输出格式(新)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!