gpt4 book ai didi

r - 如何将 Sweave pdf 放入不同的目录

转载 作者:行者123 更新时间:2023-12-04 04:37:21 24 4
gpt4 key购买 nike

在 Ubuntu 中,假设在 /home/folder1我有 test.Rnw .生成 pdf我会去(假设这个目录是我的 getwd )在我的 R 中控制台:

Sweave(test.Rnw)
texi2pdf(test.tex)

但是,我的目标是拥有 pdf保存在另一个名为 /home/folder2 的现有文件夹中.我如何编译 .Rnw (将保留在 /home/folder1 中)以及由此产生的 .tex (不关心它进入哪个文件夹)这样 pdf结束于 /home/folder2 ?

似乎我想干扰 Sweave(...) 中的任一参数或 texi2pdf(...)但还没有找到我可以切换来设置导出目录的参数。

最佳答案

使用更简单 knitr包:

knit2pdf(input=/home/folder1/test.Rnw, 
output =/home/folder2/test.pdf)

另一种选择是使用 pandoc :
pandoc -f latex /home/folder1/test.tex -s -o /home/folder2/test.pdf

关于r - 如何将 Sweave pdf 放入不同的目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19519682/

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