如何编织/编织为其他文件名? [英] How to knit/Sweave to a different file name?

查看:67
本文介绍了如何编织/编织为其他文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,knit/Sweave命令将生成一个与.Rnw文件同名的tex文件.我想给它和随后的pdf文件一个不同的名称吗?

By default, the knit/Sweave command will generate a tex file with the same name as the .Rnw file. I want to give it and the subsequent pdf file a different name is it possible?

推荐答案

.Rmd文件的标题中,您可以指定文件名:

In the header of an .Rmd file, you can specify a file name:

---
title: "My title"
output:
  pdf_document:
    pandoc_args: [ 
      "--output=Custom_name.pdf" 
    ]
---

对于.Rnw文件,您可以直接调用函数knitr::knit2pdf:

For .Rnw files you can directly call the function knitr::knit2pdf:

knit2pdf(input.Rnw, output="Custom_name.pdf") 

这篇关于如何编织/编织为其他文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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