accumulate_by <- function(dat, var) {
var <- lazyeval::f_eval(var, dat)
lvls <- plotly:::getLevels(var)
dats <- lapply(seq_along(lvls), function(x) {
cbind(dat[var %in% lvls[seq(1, x)], ], frame = lvls[[x]])
})
dplyr::bind_rows(dats)
}
d <- txhousing %>%
filter(year > 2005, city %in% c("Abilene", "Bay Area")) %>%
accumulate_by(~date)
If you implement a cumulative animation in the manner of the function above, the number of rows will increase too much.
I use a thousand frames and a row of ten thousand. Because of the large number of data, the work in progress has been disturbed.
https://plot.ly/r/cumulative-animations/
Is there any way to create a cumulative animation other than the example?
If you implement a cumulative animation in the manner of the function above, the number of rows will increase too much.
I use a thousand frames and a row of ten thousand. Because of the large number of data, the work in progress has been disturbed.
https://plot.ly/r/cumulative-animations/
Is there any way to create a cumulative animation other than the example?