gpt4 book ai didi

r - 当 .Rnw 有一个带有 "results"选项的 block 时,R 中的 Sweave 函数失败

转载 作者:行者123 更新时间:2023-12-05 08:13:13 28 4
gpt4 key购买 nike

我想使用“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 内容需要用 latex 来。 The simple question, therefore, is, when the option results='asis' works on RStudio (Complile PDF), why it does not with Sweave function call?我错过了什么吗?

任何关于此的灯将不胜感激......提前致谢。

问候,塔玛

最佳答案

转到 RStudio > 首选项 > Sweave

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

关于r - 当 .Rnw 有一个带有 "results"选项的 block 时,R 中的 Sweave 函数失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17843499/

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