【发布时间】:2013-07-26 21:12:39
【问题描述】:
我不断收到此错误; Rscript --verbose --no-save --no-restore -- 我在这里看到其他人也得到了它,所以我不希望它重复。
我只是一个“普通的乔”,想学习一些 R,并希望能够在 lyx/knitr 中报告,因此我不太了解乳胶或一般编码。
话虽如此,我会尽力描述这个问题。
我能够编译 knitr 文件夹中提供的一些演示,以及一些我自己制作的简单演示。但是由于某种原因,出现了上述错误并且文档被破坏 - 这意味着,即使我删除了所有代码,我也无法编译它。
错误似乎几乎是随机出现的,在图片中您可以看到错误。第一个测试很顺利——虽然它出现在我使用 hist() 命令时——这一次它出现在我试图获取工作目录时,我已经能够做到没有错误。
我不确定这是我的错误还是 Knitr/Lyx 中的错误 - 希望您能帮助我确定是哪一个。
!!编辑;按要求记录 Lyx。
22:47:42.732: Previewing ...
22:47:42.739: (buffer-view: Ctrl+R)
22:47:42.779: Rscript --verbose --no-save --no-restore "C:/Program Files (x86)/LyX 2.0/Resources/scripts/lyxknitr.R" "C:/Users/Toddi/AppData/Local/Temp/lyx_tmpdir.Hp4668/lyx_tmpbuf2/""newfile1.Rnw" "C:/Users/Toddi/AppData/Local/Temp/lyx_tmpdir.Hp4668/lyx_tmpbuf2/""newfile1.tex" ISO-8859-15 "C:/Users/Toddi/Documents/"
Running: Rscript --verbose --no-save --no-restore "C:/Program Files (x86)/LyX 2.0/Resources/scripts/lyxknitr.R" "C:/Users/Toddi/AppData/Local/Temp/lyx_tmpdir.Hp4668/lyx_tmpbuf2/""newfile1.Rnw" "C:/Users/Toddi/AppData/Local/Temp/lyx_tmpdir.Hp4668/lyx_tmpbuf2/""newfile1.tex" ISO-8859-15 "C:/Users/Toddi/Documents/"
22:47:43.408:
|
| | 0%
|
22:47:43.409:
|...................... | 33%
22:47:43.409: ordinary text without R code
22:47:43.409:
22:47:43.409:
|
|........................................... | 67%
22:47:43.409: label: test
22:47:43.410: running
22:47:43.410: 'C:\PROGRA~1\R\R-30~1.1\bin\i386\Rterm.exe --slave --no-restore --no-save --no-restore --file=C:/Program Files (x86)/LyX 2.0/Resources/scripts/lyxknitr.R --args C:/Users/Toddi/AppData/Local/Temp/ly
22:47:43.410: x_tmpdir.Hp4668/lyx_tmpbuf2/newfile1.Rnw C:/Users/Toddi/AppData/Local/Temp/lyx_tmpdir.Hp4668/lyx_tmpbuf2/newfile1.tex ISO-8859-15'
22:47:43.411:
22:47:43.411:
22:47:43.411:
22:47:43.411: processing file: C:/Users/Toddi/AppData/Local/Temp/lyx_tmpdir.Hp4668/lyx_tmpbuf2/newfile1.Rnw
22:47:43.456:
22:47:43.457: Advarsel i block_exec(params) :
22:47:43.457: failed to tidy R code in chunk <test>
22:47:43.459: reason: Error in base::parse(text = text, srcfile = NULL) : 3:1: unexpected '@'
22:47:43.459: 2: hist(q)
22:47:43.459: 3: @
22:47:43.460: ^
22:47:43.460:
22:47:43.460: Quitting from lines 11-15 (C:/Users/Toddi/AppData/Local/Temp/lyx_tmpdir.Hp4668/lyx_tmpbuf2/newfile1.Rnw)
22:47:43.461: Fejl i parse(text = x, srcfile = src) : <text>:3:1: unexpected '@'
22:47:43.461: 2: hist(q)
22:47:43.461: 3: @
22:47:43.461: ^
22:47:43.461: Calls: knit ... evaluate -> parse_all -> parse_all.character -> parse
22:47:43.461: Execution halted
..\..\..\src\support\Systemcall.cpp (273): Systemcall: 'Rscript --verbose --no-save --no-restore "C:/Program Files (x86)/LyX 2.0/Resources/scripts/lyxknitr.R" "C:/Users/Toddi/AppData/Local/Temp/lyx_tmpdir.Hp4668/lyx_tmpbuf2/""newfile1.Rnw" "C:/Users/Toddi/AppData/Local/Temp/lyx_tmpdir.Hp4668/lyx_tmpbuf2/""newfile1.tex" ISO-8859-15 "C:/Users/Toddi/Documents/"' finished with exit code 1
Error: Cannot convert file
----------------------------------------
An error occurred while running:
Rscript --verbose --no-save --no-restore "C:/Program Files (x86)/LyX
2.0/Resources/scripts/lyxknitr.R"
"C:/Users/Toddi/AppData/Local/Temp/lyx_tmpdir.Hp4668/lyx_tmpbuf2/""newfile1....
22:51:00.499: Automatic save done.
22:51:51.362: Error while previewing format: pdf2
编辑 2;
你是这个意思吗?
% Preview source code for paragraph 0
<<test>>=
q <- rnorm(100)
hist(q)
@<<test2>>=
getwd()
@
我在@ 和<<test>>= 之间添加了一条线,现在它可以工作了。但我想我已经看到它在代码位之间有文本的地方失败了。我会注意这一点,以后会尝试查看源代码,谢谢您的时间!
【问题讨论】:
-
请编辑您的帖子并将完整的消息日志粘贴到此处(在 LyX 中,
View-->View Messages) -
我有一个后续问题;当我退出一个 teX 代码框时,我按 esc - 这会导致错误,我可以在源代码中看到它变成了@(后面是我写的任何内容),如上面的示例所示。我可以在 esc 后按 Enter 来解决这个问题,这是“正确”的方式还是有更好的方式退出代码框?
-
我不知道。我从未点击过
Esc——我只是使用鼠标单击或向右箭头移出 ERT 框。