Could not run gganimation

Hi ,

I am trying to run germination in mac R studio, but I see getting the following error message (please see the details below). I look forward to your advise. Regards, J

> library(ggplot2)
> library(gganimate)
> ggplot(care, aes(lifeexp,Expected, size =Total, colour = Country)) +
+ geom_point(alpha = 0.7, show.legend = FALSE) +
+ scale_size(range = c(2, 12)) +
+ scale_x_log10() +
+ # Here comes the gganimate specific bits
+ labs(title = 'Year: {frame_time}', x = 'GDP per capita', y = 'life expectancy') +
+ transition_time (Year) +
+ ease_aes('linear')
sh: ffmpeg: command not found                                   
Error in file(what, "rb") : cannot open the connection
In addition: Warning messages:
1: In system2(ffmpeg, c(paste0("-i ", file_glob), "-y", "-loglevel quiet",  :
  error in running command
2: In file(what, "rb") :
  cannot open file '/var/folders/f7/h414b25n5g3cbd1zb6qd13lw0000gn/T//Rtmphrb0VD/file24f81b225152.mp4': No such file or directory

It may or may not be that your problem is not with gganimate
Can you please create a reprex?
Also, any chance you can reformat the opening post to designate the beginning and the end of the code chunk?
Thank you!

hi,

Here is reprex

library(ggplot2)
library(gganimate)
ggplot(care, aes(lifeexp,Expected, size =Total, colour = Country)) +
geom_point(alpha = 0.7, show.legend = FALSE) +
scale_size(range = c(2, 12)) +
scale_x_log10() +
# Here comes the gganimate specific bits
labs(title = 'Year: {frame_time}', x = 'GDP per capita', y = 'life expectancy') +
transition_time (Year) +
ease_aes('linear')
#> Error in ggplot(care, aes(lifeexp, Expected, size = Total, colour = Country)): object 'care' not found

Created on 2018-12-18 by the reprex package (v0.2.1)

Hi,

Here is reprex.

It says object care is not found. But data=care is open in R.

library(ggplot2)
library(gganimate)
ggplot(care, aes(lifeexp,Expected, size =Total, colour = Country)) +
geom_point(alpha = 0.7, show.legend = FALSE) +
scale_size(range = c(2, 12)) +
scale_x_log10() +
# Here comes the gganimate specific bits
labs(title = 'Year: {frame_time}', x = 'GDP per capita', y = 'life expectancy') +
transition_time (Year) +
ease_aes('linear')
#> Error in ggplot(care, aes(lifeexp, Expected, size = Total, colour = Country)): object 'care' not found

Created on 2018-12-18 by the reprex package (v0.2.1)

Have you updated to the latest development version of gganimate? this seems related to this issue https://github.com/thomasp85/gganimate/issues/201

1 Like

Yes. I have installed the latest version.

care dataset might be open in your session but reprex renders examples in a new clean session so if care comes packed with some package you also have to loaddit explicitly.

1 Like

Quoting thomasp85 in this related issue Error in file(what, "rb") : cannot open the connection · Issue #228 · thomasp85/gganimate · GitHub

Anyway if you install gifski or magick you should be fine until it is fixed

PD. gifsky and magick are software separate from r and rstudio

Thanks for the quick response.what should I do now? I am new to R.

thanks, let me try and install gifski or magick

Thanks Andresrcs. I am installing magick software for mac. I have also found magick package in R https://cran.r-project.org/web/packages/magick/vignettes/intro.html

Do I have to install both?

Yes, you should, magick package is a wrapper for the magick software.

thanks. now I am getting following error message

Error in ggplot(data = care, aes(lifeexp, Expected, size = Total, colour = Country)) : **
** could not find function "ggplot"

Have you loaded ggplot2 library again? Remember every time your session restarts you have to reload the packages you want to use

1 Like

Wow. It works, thank you very much for helping me with this problem. I truly appreciate this help.

1 Like

If your question's been answered (even if by you), would you mind choosing a solution? (See FAQ below for how).

Having questions checked as resolved makes it a bit easier to navigate the site visually and see which threads still need help.

Thanks

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.