将Rnw编译为tex时出错 [英] Error compiling Rnw to tex
问题描述
我在使用功能 Sweave
时遇到问题.这似乎是一个编码问题,因为我没有指定任何编码,例如:\ usepackage [latin1] {inputenc}.
I had a problem using function Sweave
. It seemed to be an encoding problem because I did not specify any encoding like: \usepackage[latin1]{inputenc}.
现在使用编译PDF"按钮可以工作->生成PDF,一切都OK.但是我收到30条警告和18条错误信息框.
Now using button "Compile PDF" works -> PDF is generated and everythink is OK. But I'm getting 30 warnings and 18 badboxes.
使用函数 Sweave
首先生成tex文件失败,并显示以下消息:
Using function Sweave
to generate first the tex file fails with this message:
Error: chunk 4 (label = t4)
Error in file(con, "w") : cannot open the connection
In addition: There were 31 warnings (use warnings() to see them)
因此,警告比以前多了.
So one warning more than before.
你有什么主意吗?
推荐答案
问题是通过对R代码设置的路径使用..创建的.使用带有"C:\ Users \ test \"而不是".. \ test \"的完整路径可以解决此问题.因此无法加载文件夹"test"中的代码,因为Sweave-Function使用了其他路径(例如WORKING DIRECTORY).
The problem was created by using .. for the paths setted by the R code. Using complete path with "C:\Users\test\" instead of "..\test\" solved the problem. So the code from folder "test" couldnt be loaded because the Sweave-Function used other paths (like WORKING DIRECTORY).
这篇关于将Rnw编译为tex时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!