3

我想最终使用“R”脚本将我的 Sweave 文件转换为 PDF。我了解到,Sweave(file="TEST.Rnw") 是可以将我的 .Rnw 转换为 .tex 的函数。

但是当我在具有如下代码块的 .Rnw 文件上使用它时,我看到了一个奇怪的问题:

    <<results='asis', comment=NA, echo=FALSE, warning=FALSE>>=
    ...
    @

这是错误,我得到:

Error in match.arg(options$results, c("verbatim", "tex", "hide")) :
'arg' should be one of "verbatim", "tex", "hide"

请注意,当我更改 results='tex' 时,Sweave() 会起作用。但这对我没有帮助,因为我有一些需要以乳胶形式出现的 xtable 内容。The simple question, therefore, is, when the option results='asis' works on RStudio (Complile PDF), why it does not with Sweave function call? 我错过了什么吗?

任何关于此的灯都将受到高度赞赏......提前谢谢。

问候, 塔玛

4

2 回答 2

0

转到 RStudio > 首选项 > Sweave

将“Weave Rnw files using:”设置为“knitr”并确保您已安装 knitr ( install.packages("knitr"))

于 2021-10-08T16:53:45.033 回答
-4

尝试通过result=tex(不带引号)。

于 2016-11-30T14:00:30.550 回答