-
Notifications
You must be signed in to change notification settings - Fork 1
/
gif_archive_active_percent.R
45 lines (30 loc) · 1 KB
/
gif_archive_active_percent.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# MAKE GIF of archive
library(magick)
dir_out <- file.path("archive/active_users_percent")
## list file names and read in
imgs <- list.files(dir_out, full.names = TRUE)
img_list <- lapply(imgs, image_read)
## join the images together
img_joined <- image_join(img_list)
## animate at 2 frames per second
img_animated <- image_animate(img_joined, fps = 0.5)
## view animated image
img_animated
## save to disk
image_write(image = img_animated,
path = "active_users_percent.gif")
# Now make gif for number of daily users
dir_out <- file.path("archive/users")
imgs <- list.files(dir_out, full.names = TRUE)
# Only keep all-time users
imgs <- imgs[grepl( "all_users", imgs, fixed = TRUE)]
img_list <- lapply(imgs, image_read)
## join the images together
img_joined <- image_join(img_list)
## animate at 2 frames per second
img_animated <- image_animate(img_joined, fps = 0.5)
## view animated image
img_animated
## save to disk
image_write(image = img_animated,
path = "all_time_users.gif")