码
\input{./A1_sample/sample.Rnw}如何包含Rnw文件,以便执行文件中的R代码?使用\input不起作用。
发布于 2016-04-18 08:55:14
命令是\SweaveInput。
用法:
开始{文档}
\SweaveInput{PATH_TO_RNW_FILE/RNW_FILE.Rnw}
结束{文档}
有关更多信息,请参见:https://support.rstudio.com/hc/en-us/articles/200486298-Working-with-Multiple-Rnw-Files
发布于 2016-05-14 12:17:16
patchDVI包为处理多个文件文档提供了各种项目管理工具。它需要一些设置,但在TeXShop或TeXworks中工作得很好。不幸的是,我不认为RStudio可以很容易地定制来使用它。
您的文档main.Rnw应该如下所示:
\documentclass{article}
<<echo=FALSE,results="asis">>=
# .SweaveMake <- 2 # For complete make, uncomment this
.SweaveFiles <- c("file1.Rnw", "file2.Rnw", "file3.Rnw")
.TexRoot <- "main.tex"
@
\begin{document}
\input{file1}
\input{file2}
\input{file3}
\end{document}每个file*.Rnw文件都有一个类似的头部,将main.Rnw和其他相关文件作为.SweaveFiles列出。然后,当编译器处理文件时,可以告诉编译器在所有更改的文件上运行Sweave,在main.tex上运行main.tex。
https://stackoverflow.com/questions/36550862
复制相似问题