R gganimate无法正确调用ImageMagick,可能存在路径错误

R gganimate无法正确调用ImageMagick,可能存在路径错误,r,gganimate,R,Gganimate,我正在尝试在Windows7中安装gganimate。我已经为ImageMagick添加了路径,下面是我在尝试安装它时使用的代码 library(httr) set_config(config(ssl_verifypeer = 0L)) library(devtools) library(RCurl) devtools::install_github("RcppCore/Rcpp") devtools::install_github("dgrtwo/gganimate") install.pac

我正在尝试在Windows7中安装gganimate。我已经为ImageMagick添加了路径,下面是我在尝试安装它时使用的代码

library(httr)
set_config(config(ssl_verifypeer = 0L))
library(devtools)
library(RCurl)
devtools::install_github("RcppCore/Rcpp")
devtools::install_github("dgrtwo/gganimate")
install.packages("gapminder")
library(gapminder)
library(ggplot2)
theme_set(theme_bw())
p <- ggplot(gapminder, aes(gdpPercap, lifeExp, size = pop, color =continent,   frame = year)) +
geom_point() +
scale_x_log10()

library(gganimate)

install.packages("cowplot")
install.packages("animation")
library(animation)
ani.options(convert = shQuote('C:/Program Files/ImageMagick-7.0.3-  Q16/magick.exe'))
gganimate(p)
库(httr)
设置配置(配置(ssl\U verifypeer=0L))
图书馆(devtools)
图书馆(RCurl)
devtools::install_github(“RcppCore/Rcpp”)
devtools::install_github(“dgrtwo/gganimate”)
安装程序包(“gapminder”)
图书馆(gapminder)
图书馆(GG2)
theme_set(theme_bw())

p在
ani中使用
shortPathName
函数更改路径。选项对我来说很有用:

magickPath <- shortPathName("C:\\Program Files\\ImageMagick-7.0.3-Q16\\magick.exe")
ani.options(convert=magickPath)

magickPath我发现路径名中的空格给我带来了问题。我将路径名从更改为

ani.options(convert = "C:/Program Files/ImageMagick-7.0.3-Q16/magick.exe")


然后我又能保存GIFs了

谢谢!在此之前30分钟一直在寻找解决方案:)
ani.options(convert = "C:/PROGRA~1/ImageMagick-7.0.3-Q16/magick.exe")