While replicating a question posed on this website, I tried to rerun the following code
data <- structure(list(x = 1:6, y = 2:7, year = c(2010L, 2010L, 2011L,
2011L, 2012L, 2012L)), class = "data.frame", row.names = c(NA,
-6L))
library(tidyverse)
library(gganimate)
p <- ggplot(data, aes(x, y))+
geom_point() +
transition_time(year) +
labs(title = "Year: {as.integer(frame_time)}")
p_anim <- animate(p, nframes = 30, fps = 4)
anim_save("myfig.gif", p_anim)
While it was supposed to work fine, I received the following error, which I am usually getting in making animated visualizations with gganimate
such as replicating the animated map in this post
Invalid input type, expected 'double' actual 'logical'
.
I do not understand why this error occurs, and I could not find any similar posts on the web except this post, which is unanswered. Therefore, I welcome your replies regarding this error. Thank you beforehand.
I can't seem to replicate your error:
I'd suggest checking your R and package versions (e.g. with
sessionInfo()
) and make sure they're all up-to-date.Output of your code + my sessionInfo():