-
Notifications
You must be signed in to change notification settings - Fork 3
/
5-prepare_viz_for_dashboard.R
38 lines (28 loc) · 1.73 KB
/
5-prepare_viz_for_dashboard.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
## Libraries
if (!require("pacman")) install.packages("pacman")
pacman::p_load(tidyverse,
stringi)
## In order to upload the visualizations for the dashboard we need to remove spaces and commas, and uniform the encoding
## For the htmls
file.rename(list.files(here("visualizations", "maps"), full.names = T),
str_replace_all(list.files(here("visualizations", "maps"), full.names = T), " ", "_"))
file.rename(list.files(here("visualizations", "maps"), full.names = T),
str_replace_all(list.files(here("visualizations", "maps"), full.names = T), ",", ""))
file.rename(list.files(here("visualizations", "maps"), full.names = T),
stri_trans_general(list.files(here("visualizations", "maps"), full.names = T), "Latin-ASCII"))
## For the pngs
file.rename(list.files(here("visualizations", "density_plots"), full.names = T),
str_replace_all(list.files(here("visualizations", "density_plots"), full.names = T), " ", "_"))
file.rename(list.files(here("visualizations", "density_plots"), full.names = T),
str_replace_all(list.files(here("visualizations", "density_plots"), full.names = T), ",", ""))
file.rename(list.files(here("visualizations", "density_plots"), full.names = T),
stri_trans_general(list.files(here("visualizations", "density_plots"), full.names = T), "Latin-ASCII"))
## We also need to create a file for the dropdown selector
selector <- lau_matched %>%
st_set_geometry(NULL) %>%
select(country_id, region) %>%
unique() %>%
arrange(country_id, region) %>%
mutate(region = str_replace_all(region, ",", ""),
region = stri_trans_general(region, "Latin-ASCII")) %>%
write_csv("selector_az.csv")