首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Lyx调用Rscript中的错误

Lyx调用Rscript中的错误
EN

Stack Overflow用户
提问于 2013-06-09 15:08:40
回答 1查看 1.2K关注 0票数 4

我在OS (10.8.3)和R (3.01)上使用Lyx (2.06)。我正试图把一个针织品文件导入莱克斯。Lyx能够找到Rstudio,但是Rscript在setwd命令上失败。下面是来自Lyx的错误日志。任何帮助都将不胜感激。(我的第一篇文章是Stackoverflow。为任何尴尬的格式事先表示歉意。)

代码语言:javascript
复制
10:43:17.114: Importing ~/Documents/Temp/stest.lyx...
10:43:17.122: Rscript --verbose --no-save --no-restore "/Applications/LyX.app/Contents/Resources/scripts /lyxknitr.R" "/Users/wms5f/Documents/Temp/""stest.Rnw" "/Users/wms5f/Documents/Temp/""stest.tex"  "/Users/wms5f/Documents/Temp/"
10:43:17.124: running
10:43:17.125:   '/Library/Frameworks/R.framework/Versions/3.0/Resources/bin/R --slave --no-restore --no-save --no-restore --file=/Applications/LyX.app/Contents/Resources/scripts/lyxknitr.R --args /Users/wms5f/Docu
10:43:17.126: ments/Temp/stest.Rnw /Users/wms5f/Documents/Temp/stest.tex'
10:43:17.126: 
<.snip.>
10:43:18.424: 
10:43:18.603: Package `sm', version 2.2-5: type help(sm) for summary information
10:43:20.609: Error in setwd(.cmdargs[4]) : missing value is invalid
10:43:20.610: Execution halted

Running: Rscript --verbose --no-save --no-restore "/Applications/LyX.app/Contents/Resources/scripts/lyxknitr.R" "/Users/wms5f/Documents/Temp/""stest.Rnw" "/Users/wms5f/Documents/Temp/""stest.tex"  "/Users/wms5f/Documents/Temp/"
support/Systemcall.cpp (273): Systemcall: 'Rscript --verbose --no-save --no-restore "/Applications/LyX.app/Contents/Resources/scripts/lyxknitr.R" "/Users/wms5f/Documents/Temp/""stest.Rnw" "/Users/wms5f/Documents/Temp/""stest.tex"  "/Users/wms5f/Documents/Temp/"' finished with exit code 1
Error: Cannot convert file

An error occurred while running:
Rscript --verbose --no-save --no-restore
"/Applications/LyX.app/Contents/Resources/scripts/lyxknitr.R"
"/Users/wms5f/Documents/Temp/""stest.Rnw"
"/Users/wms5f/Documents/Temp/""stest.tex"  "/Users/wms5f/Documents/Temp/"
10:43:55.912: file not imported!
10:43:55.913: (buffer-import knitr)
10:44:04.097: (dialog-show prefs: ⌘,)

补充澄清:

在我最初的帖子中,我可能不太清楚。我有一个名为stest.Rnw的文件,它包含以下的sweave代码:

代码语言:javascript
复制
\documentclass{article}
\begin{document}

Test

\end{document}

如果我尝试使用Import -> Rnw (knitr)选项将该文件导入LYX2.06,Lyx将生成以下系统命令:

代码语言:javascript
复制
Rscript --verbose --no-save --no-restore "/Applications/LyX.app/Contents/Resources/scripts/lyxknitr.R" "/Users/wms5f/Documents/Temp/""stest2.Rnw" "/Users/wms5f/Documents/Temp/""stest2.tex"  "/Users/wms5f/Documents/Temp/"

此命令在从bash提示符运行时以及在Lyx中运行时都会失败。我注意到了额外的双引号,但是在运行脚本之前删除它们会得到相同的结果。Rscript似乎不能解析第四个参数,这只是一个目录。R永远不会解析这个浪涌,因为它在对Lyx传递给它的参数的初始解析上失败了。至少这就是我读取错误信息的方式。

我希望这是有帮助的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-06-10 00:18:45

您试图将一个Rnw文件导入到LyX中,LyX 2.0.6中还不支持这个文件。它将出现在LyX 2.1:http://www.lyx.org/trac/ticket/7838中。

发布LyX 2.1后,可以通过命令行导入:

代码语言:javascript
复制
tex2lyx -n -m knitr stest.Rnw

我不知道为什么LyX在导入文件时需要调用Rscript。您可能需要向LyX提交错误报告。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17010979

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档