Problem with using 'gganimate' package

I want to use gganimate package for making animation of oil production for each well, displaying oil production on y-axis and date on x-axis and animating the yearly production.

I have installed these packages (gapminder, ggplot2, gganimate, devtools & dplyr)

The code:

ggplot(gapminder, aes(date, oil, size = pop, colour = well)) +
geom_point(alpha = 0.7, show.legend = FALSE) +
scale_x_date(date_labels = "%Y-%m-%d") +
facet_wrap(~well) + labs(title = 'Year: {frame_time}', x = 'date', y = 'oil_rate') +
transition_time(Year) +
ease_aes('linear')

Error:

Error in transition_time(Year) :
could not find function "transition_time"

I have never used gganimate, but the error message suggests the package isn't loaded. If you run search(), do you see gganimate in the list of packages? If not, run library(gganimate).

I am quite confused. The only dataset in the gapminder package installed on my computer has six variables: country, continent, year, lifeExp, pop, and gdpPercap.

1 Like

I have installed all these libraries:
install.packages("gapminder")
library(gapminder)
install.packages('gganimate')
library(gganimate)
install.packages('ggplot2')
library(ggplot2)
install.packages('dplyr')
library(dplyr)
install.packages('devtools')
library(devtools)
install.packages('gifski')
library(gifski)
install.packages('av')
library(av)

Here the code:

ggplot(gapminder, data = EH, mapping = aes(x = date, y = oil, colour = well)) + geom_point(size = 3) +
scale_x_date(date_labels = "%Y-%m-%d") +
facet_wrap(~well) + labs(title = 'Year: {frame_time}', x = 'date', y = 'oil_rate') +
transition_time(Year) +
shadow_mark(alpha=0.2, size = 2) +
ease_aes('linear')

Still have this error:

Error in transition_time(Year) :
could not find function "transition_time"

transition_time() should be part of gganimate

So loading the package should work, you can try example of the page above to see how this works.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.