我想tweenr与date格式变量一起使用timepoints.
但是,tweenr::tween_elements抛出一个错误,我无法破译:
> Error in `/.difftime`(diff(timerange), nframes) :
second argument of / cannot be a "difftime" object
我使用了错误的tweenr功能吗?这很可能是一些预期的行为,但我无法理解这一点。
可重现的例子:
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')