Lyx调用Rscript时出错[关闭](Error in Lyx call to Rscript [closed])

编程入门 行业动态 更新时间:2024-10-17 19:31:32
Lyx调用Rscript时出错[关闭](Error in Lyx call to Rscript [closed])

我在OS X(10.8.3)上使用Lyx(2.06)和R(3.01)。 我想将一个knitr文件导入Lyx。 Lyx能够在setwd命令中找到Rstudio但Rscript失败。 来自Lyx的错误日志如下。 任何帮助将非常感激。 (我在Stackoverflow上的第一篇文章。对任何笨拙的格式都提前道歉。)

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代码:

\documentclass{article} \begin{document} Test \end{document}

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

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永远不会解析sweave,因为它在Lyx传递给它的参数的初始解析时失败了。 至少这是我阅读错误消息的方式。

我希望这是有帮助的。

I am using Lyx (2.06) on OS X (10.8.3) with R (3.01). I am trying to import a knitr file into Lyx. Lyx is able to find Rstudio but Rscript fails on the setwd command. The error log from Lyx is below. Any help would be much appreciated. (My first post to Stackoverflow. Apologies in advance for any awkward formatting.)

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: ⌘,)

Added clarification:

I may not have been very clear in my initial post. I have a file called stest.Rnw which contains the following sweave code:

\documentclass{article} \begin{document} Test \end{document}

If I try to import this file into Lyx 2.06 using the Import -> Rnw (knitr) option, Lyx generates the following system command:

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/"

This command fails when run from the bash prompt as well as from within Lyx. I noticed the extra double quotes, but removing them before running the script gets the same result. It does not appear that Rscript is able to parse the 4th argument, which is just a directory. R is never getting to parsing the sweave because it is failing on the initial parsing of the arguments passed to it by Lyx. At least this is how I read the error message.

I hope this is helpful.

最满意答案

您试图 Rnw文件导入LyX,LyX 2.0.6尚不支持。 它计划出现在LyX 2.1中: http ://www.lyx.org/trac/ticket/7838

当LyX 2.1发布时,您可以通过命令行导入:

tex2lyx -n -m knitr stest.Rnw

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

You were trying to import an Rnw file into LyX, which is not supported in LyX 2.0.6 yet. It is scheduled to appear in LyX 2.1: http://www.lyx.org/trac/ticket/7838

When LyX 2.1 is released, you can import via the command line:

tex2lyx -n -m knitr stest.Rnw

I'm not sure why LyX needs to call Rscript when importing a file. You may want to file a bug report to LyX.

更多推荐

本文发布于:2023-08-06 14:45:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1450311.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Rscript   Lyx   Error   closed   call

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!