将一个markdown文件编织为两个输出文件 [英] Knit one markdown file to two output files

查看:78
本文介绍了将一个markdown文件编织为两个输出文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将单个.md文件编织到R的工作目录中的.html或.docx,同时将.html副本发布到另一个文件夹(可能在另一个驱动器上)?

或者,可以使用RStudio中的发布"按钮将.md文件发送到RPub以外的位置吗?

解决方案

是的,可以渲染多个输出,但不能使用RStudio中的编织"按钮.在YAML标头中写入所需的输出,然后在

title: "multiple outputs"
output:
     word_document: default
     html_document: default

中使用output_format = "all"作为参数

rmarkdown::render(<your-rmd-file.rmd>, output_format ="all")

因此YAML标头看起来像:

title: "multiple outputs"
output:
     word_document: default
     html_document: default

或者您要为不同输出格式设置的任何选项.

我不知道是否可以设置不同的输出目录,但我认为不是.

Is there a way to knit a single .md file to a .html or .docx in the working directory in R and simultaneously post a copy of the .html to another folder, possibly on another drive?

Alternatively, can the 'publish' button in RStudio be used to send a .md file to a location other than RPubs?

解决方案

Yes it's possible to render multiple outputs, but not with the "knit" Button in RStudio. Write your desired output in the YAML header and then use output_format = "all" as argument in

rmarkdown::render(<your-rmd-file.rmd>, output_format ="all")

So the YAML header looks like:

title: "multiple outputs"
output:
     word_document: default
     html_document: default

Or any option you want to set for the different output formats.

I don't know if it is possible to set different output directories, but I don't think so.

这篇关于将一个markdown文件编织为两个输出文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆