Skip to main content

[How-To] Installation of gganimate and devtools for R in an Anaconda environment

I have recently started to play around with gganimate to create some animated graphs based on the ggplot framework. This allows you to include another dimension in your chart, e.g. a time dimension for a scatter plot and save them as gifs. You can see some cool examples on the gganimate github page which I linked before.

I had some complication with installing devtools which is necessary to install gganimate through github. I think I only had these problem because I am running R/RStudio in the Anaconda environment.

When trying to install devtools through install.packages("devtools") I got the below error:
x86_64-apple-darwin13.4.0-ar: no such file or directory make: *** [libmygit.a] error 1 error: compilation failed for package ‘git2r’
devtools requires git2r to be installed as a dependency but somehow this failed for my R environment. The solution to my problem was to install git2r beforehand through Anaconda directly by running the following line in the terminal:
conda install -c r r-git2r 
After this has succeeded you should be able to install devtools with install.packages("devtools") in R. After this has been successful you can follow the installation process for gganimate:
library(devtools)
devtools::install_github("dgrtwo/gganimate")


I hope this is helpful and will save people who are running into the same problem some time.

Comments