-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path6_dashboard.R
103 lines (85 loc) · 4.21 KB
/
6_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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
### Using collaborative open science tools to improve engagement with the
# ecology of the Guana River Estuary
# Geraldine Klarenberg, PhD
# 17 May 2023
# Visualizing dashboard data
# Start all runs of this script with:
renv::restore()
# This ensures it uses the packages last used when everything worked okay. This
# also ensures these packages are installed if you don't have them
library(tidyverse)
#### Load data --------------------------------------------------
dashboard <- read_csv("2_data_deidentified/subsets/dashboard_results_basic.csv")
#### Visualize dashboard preferences ------------------------------------------
# T-1 How to access? (QID23)
# T-2 Type of information? (QID25)
# T-3 Form of information? (QID49)
# T-4 Data delivery? (QID24)
# All these questions are questions where people could pick several items
##### T-1 How to access? (QID23) ---------------------------------------------
ggplot(dashboard %>%
filter(qname_main == "T-1"),
aes(y = fct_rev(fct_infreq(q_text)), fill = q_text))+
geom_bar() +
labs(y = "", x = "", title = "How would you prefer to access data?") +
#scale_x_continuous(breaks = function(x) seq(ceiling(x[1]), floor(x[2]), by = 1))+
scale_fill_viridis_d()+
theme_bw()+
theme(legend.position = "none", axis.text.y = element_text(size=12))
ggsave("8_results/dashboard_access.jpg")
##### T-2 Type of information? (QID25) ---------------------------------------
ggplot(dashboard %>%
filter(qname_main == "T-2"),
aes(y = fct_rev(fct_infreq(q_text)), fill = q_text))+
geom_bar() +
labs(y = "", x = "", title = "What type of information do you prefer?") +
#scale_x_continuous(breaks = function(x) seq(ceiling(x[1]), floor(x[2]), by = 1))+
scale_fill_viridis_d(option = "plasma")+
theme_bw()+
theme(legend.position = "none", axis.text.y = element_text(size=12))
ggsave("8_results/dashboard_type.jpg")
##### T-3 Form of information? (QID49) ----------------------------------------
ggplot(dashboard %>%
filter(qname_main == "T-3"),
aes(y = fct_rev(fct_infreq(q_text)), fill = factor(order)))+
geom_bar() +
labs(y = "", x = "", title = "What form of information do you prefer?") +
#scale_x_continuous(breaks = function(x) seq(ceiling(x[1]), floor(x[2]), by = 1))+
scale_fill_viridis_d(option = "rocket", name = "Rank")+
theme_bw()+
theme(axis.text.y = element_text(size=12))
ggsave("8_results/dashboard_form1.jpg", width = 12, height = 7)
# Similar plot, but with the average ranks (1 = most interested)
ggplot(dashboard %>%
filter(qname_main == "T-3") %>%
group_by(q_text) %>% summarize(ave_rank = mean(order, na.rm = TRUE)) %>%
mutate(q_text = fct_reorder(q_text, ave_rank)),
aes(x = ave_rank, y = fct_rev(q_text))) +
geom_col(fill = "royalblue")+
labs(y = "", x = "", title = "What format of data delivery would suit your needs best?\nAverage ranking (1 = most interested in)")+
theme_bw()+
theme(axis.text.y = element_text(size=15))
ggsave("8_results/dashboard_form2.jpg", width = 12, height = 7)
##### T-4 Data delivery? (QID24) ----------------------------------------------
ggplot(dashboard %>%
filter(qname_main == "T-4"),
aes(y = fct_rev(fct_infreq(q_text)), fill = factor(order)))+
geom_bar() +
labs(y = "", x = "", title = "What format of data delivery would suit your needs best?") +
#scale_x_continuous(breaks = function(x) seq(ceiling(x[1]), floor(x[2]), by = 1))+
scale_fill_viridis_d(option = "rocket", name = "Rank")+
theme_bw()+
theme(axis.text.y = element_text(size=12))
ggsave("8_results/dashboard_delivery1.jpg", width = 12, height = 7)
# Similar plot, but with the average ranks (1 = most interested)
ggplot(dashboard %>%
filter(qname_main == "T-4") %>%
group_by(q_text) %>% summarize(ave_rank = mean(order, na.rm = TRUE)) %>%
mutate(q_text = fct_reorder(q_text, ave_rank)),
aes(x = ave_rank, y = fct_rev(q_text))) +
geom_col(fill = "royalblue")+
labs(y = "", x = "", title = "What format of data delivery would suit your needs best?\nAverage ranking (1 = most interested in)")+
theme_bw()+
theme(axis.text.y = element_text(size=15))
ggsave("8_results/dashboard_delivery2.jpg", width = 12, height = 7)