3

我第一次尝试让 knitr 在 texmaker 上运行,我遵循了这个文档并且我在 Windows 7 上。但是,当我编译时,我得到以下错误堆栈:

Process started

Error in readLines(if (is.character(input2)) { : cannot open the connection Calls: <Anonymous> -> knit -> readLines

In addition: Warning message: In readLines(if (is.character(input2)) { : cannot open file 'try_easy.Rnw': No such file or directory

Execution halted

Process exited with error(s)

我试图用谷歌搜索它,但只找到了对 linux/unix 的引用,这对我的情况没有帮助。以下是我的简短测试文档:

\documentclass[a4paper]{article}


\begin{document}

<<a>>=
x=rnorm(100)
<<b>>=
<<a>>
mean(x)
@

\end{document}

这是我第一次使用stackoverflow,所以如果您需要更多信息或者我做错了什么,请告诉我。非常感谢。

更新 大家好,

我设法找出我的错误。为了将来的谷歌搜索,我将文件保存.tex.rnw. 保存为rnw解决它。由于我无法回答自己的问题,因此我在此处对其进行了编辑。

4

1 回答 1

1

当文件保存为 a.tex而不是 a时会发生此错误.Rnw,因为编译器不知道他应该“knitr-compile”具有.tex句柄的文件,除非您像这样专门设置他。

于 2014-07-11T13:36:58.347 回答