我在Macintosh OX Mountain Lion 10.8.5上使用R 3.0.2,在尝试运行此代码时遇到错误。
以下是遗传算法的链接:http://www.r-bloggers.com/genetic-algorithms-a-simple-r-example/除了最后一部分外,一切都正常。
当我尝试在R:中运行动画时,我遇到了这个错误
> # in order to save the animation
> library(animation)
> saveMovie(animate_plot(), interval = 0.1, outdir = getwd())
Error: could not find function "saveMovie"
这就是我尝试的…
> library(GraphicsMagick)
Error in library(GraphicsMagick) :
there is no package called ‘GraphicsMagick’
> saveGIF(animate_plot(), interval = 0.1, outdir = getwd())
Error: Use 'theme' instead. (Defunct; last used in version 0.9.1)
> install.packages("~/Downloads/ImageMagick-x86_64-apple-darwin14.0.0.tar", repos = NULL)
Warning in install.packages :
package ‘~/Downloads/ImageMagick-x86_64-apple-darwin14.0.0.tar’ is not available (for R version 3.0.2)
Error in install.packages : file ‘~/Downloads/ImageMagick-x86_64-apple- darwin14.0.0.tar’ is not an OS X binary package
代码在链接中,但问题是我无法在R.中安装GraphicsMagick
我尝试MacPort下载该库,并通过浏览R.中的安装包从CRAN外部的文件夹下载该库
以下是动画库的链接:http://cran.r-project.org/web/packages/animation/animation.pdf
我试着从互联网上下载这些库:ImageMagick-x86_64-apple-darwin14.0.0.tar、ImageMagick-6.90、MacPorts-2.3.3-10.8-MountainLion.pkg,但它们不起作用。我希望你能告诉我如何制作动画。谢谢
使用saveGIF而不是saveMovie即可。