I would like to use tweenr
with a date
format variable for the timepoints
.
However, tweenr::tween_elements
throws an error, that I cannot decipher:
> Error in `/.difftime`(diff(timerange), nframes) :
second argument of / cannot be a "difftime" object
Am I using the wrong tweenr
function? This is most probably some expected behaviour, but I can't get my head round this.
Reproducible Example:
if (!require(devtools)) {
install.packages("devtools")
}
devtools::install_github("thomasp85/tweenr")
library(ggplot2)
library(gganimate)
library(ggforce)
library(tweenr)
data <- data.frame(
time = rep(seq(as.Date("2000-01-01"),
as.Date("2009-01-01"),
"year"),
2),
x = c(1:10,20:11),
y = c(20:11,1:10),
group = c(rep(1,10), rep(2,10)),
ease = rep('cubic-in-out', 20)
)
data <- tween_elements(data, 'time', 'group', 'ease')