I am trying to make an animated cumulative map plot of the following data:
structure(list(station_install_date = structure(c(16684, 16684,
16684, 16684, 16684, 16684), class = "Date"), lat = c(37.548645,
37.549561, 37.550007, 37.550629, 37.552746, 37.554951), long = c(126.912827,
126.905754, 126.914825, 126.914986, 126.918617, 126.910835),
capa_sum = c(10L, 5L, 5L, 13L, 10L, 14L)), row.names = c(NA,
-6L), groups = structure(list(station_install_date = structure(c(16684,
16684, 16684, 16684, 16684, 16684), class = "Date"), lat = c(37.548645,
37.549561, 37.550007, 37.550629, 37.552746, 37.554951), .rows = structure(list(
1L, 2L, 3L, 4L, 5L, 6L), ptype = integer(0), class = c("vctrs_list_of",
"vctrs_vctr", "list"))), row.names = c(NA, -6L), class = c("tbl_df",
"tbl", "data.frame"), .drop = TRUE), class = c("grouped_df",
"tbl_df", "tbl", "data.frame"))
My code looks as below:
seoul <- get_googlemap("Seoul, South Korea", zoom=11, maptype = "roadmap")
ggmap(seoul) +
geom_point(data = install_time_df, aes(x = long, y = lat), color = "red", alpha = 0.3) +
transition_time(station_install_date) +
ease_aes("linear")
However, I keep getting the error:
Error in seq.default(range[1], range[2], length.out = nframes) :
'from' must be a finite number
Try:
p2<- ggmap(seoul) +
geom_point(data = install_time_df, aes(x = long, y = lat), color = "red", alpha = 0.3) +
transition_manual(station_install_date, cumulative = TRUE) +
ease_aes("linear")
anim2<- animate(p2, renderer = gifski_renderer())
anim_save("C:\\Users\\82104\\Desktop\\따릉이\\anim2.gif", animation = anim2)