【发布时间】:2015-05-23 20:05:08
【问题描述】:
我第一次尝试在 R 中使用 animation 包。
我正在使用这个简单的代码:
saveGIF({
for (i in 1:10) plot(runif(10), ylim = 0:1)
})
但 R 显示此错误(我已翻译成英文):
Executing:
"convert" -loop 0 -delay 100 Rplot1.png Rplot2.png Rplot3.png Rplot4.png
Rplot5.png Rplot6.png Rplot7.png Rplot8.png Rplot9.png Rplot10.png
"animation.gif"
"convert" -loop 0 -delay 100 Rplot1.png Rplot2.png Rplot3.png Rplot4.png Rplot5.png Rplot6.png Rplot7.png Rplot8.png Rplot9.png Rplot10.png "animation.gif" is not recognized like an internal or external command,
an executable program or batch file.
Parameter not valid - 0
an error occurred in the conversion... see Notes in ?im.convert
[1] FALSE
Warning messages:
1: running command 'C:\Windows\system32\cmd.exe /c "convert" -loop 0 -delay 100 Rplot1.png Rplot2.png Rplot3.png Rplot4.png Rplot5.png Rplot6.png Rplot7.png Rplot8.png Rplot9.png Rplot10.png "animation.gif"' had status 1
2: In cmd.fun(convert) :
'"convert" -loop 0 -delay 100 Rplot1.png Rplot2.png Rplot3.png Rplot4.png Rplot5.png Rplot6.png Rplot7.png Rplot8.png Rplot9.png Rplot10.png "animation.gif"' execution failed with error code 1
3: running command '"convert" -loop 0 -delay 100 Rplot1.png Rplot2.png Rplot3.png Rplot4.png Rplot5.png Rplot6.png Rplot7.png Rplot8.png Rplot9.png Rplot10.png "animation.gif"' had status 4
4: In normalizePath(path.expand(path), winslash, mustWork) :
path[1]="animation.gif": Impossible to find the file specified
问题出在哪里?
【问题讨论】:
-
看起来 R 找不到转换可执行文件。动画库需要安装 ImageMagick。是在你的电脑上吗?
-
是的,我已经用默认设置安装了它
-
convert.exe 在你的 PATH 中吗?
-
当我安装 imagemagick 时,我激活了标记:''insert un the path''。怎么判断是不是真的?
-
您必须打开一个控制台并在其中键入 convert.exe 以查看是否可以从您计算机上的任何位置找到 convert.exe。这个 consule 在 Windows 9x 年代曾被命名为 MSDOS 控制台。我不知道情况是否仍然如此。安装 imagemagick 时是否打开了 R?如果是这种情况,您可以尝试关闭并重新打开它。