-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.R
250 lines (241 loc) · 14 KB
/
ui.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
library(shiny)
library(shinyjs)
library(tableHTML)
library(plotly)
library(shinythemes)
library(shinydashboard)
library(extrafont)
library(png)
# Define UI for application that draws a histogram
fluidPage(class = "page",
useShinyjs(),
tags$head(tags$link(rel = "stylesheet", type = "text/css", href = "styles.css")),
br(),
div(class = 'lang',
radioButtons(
"lang",
label = "Language",
choices = c("English" = "en", "Français" = "fr"),
inline = TRUE,
)),
div(class = 'logo',
HTML('<img src="covidlogo_white.png", height="22%", width=22%,
style="align: left; width: 100%; height: auto;"/>','<p style="color:white;"></p>')
),
br(),
# Application title
conditionalPanel(class = 'header',
condition = "input.lang == 'en'",
h1("What are Quebecois searching for during the pandemic?", align="center"),
br(),
hr(class = 'hr'),
h5('We compiled data from Google Trends in Quebec on 700 different keywords across 70 categories beginning on January 1st, 2020. This is a tool to explore and compare the impacts of COVID-19 on our internet search and consumer behavior. This tool allows us to discover certain trends such as how search interest "theater" sharply decreased after the first Quebec case was announced or how "Zoom" has seen a significant increase.'),
hr(class = 'hr'),
),
conditionalPanel(class = 'header',
condition = "input.lang == 'fr'",
h1("Que recherchent les Québécois pendant la pandémie?", align="center"),
br(),
hr(class = 'hr'),
h5("Nous avons compilé des données de Google Trends au Québec sur 700 mots clés différents dans 70 catégories à partir du 1er janvier 2020. Il s'agit d'un outil pour explorer et comparer les impacts de COVID-19 sur notre recherche sur Internet et le comportement des consommateurs. Cet outil nous permet de découvrir certaines tendances telles que la façon dont le 'théâtre' d'intérêt pour la recherche a fortement diminué après l'annonce du premier cas au Québec ou comment 'Zoom' a connu une augmentation significative."),
hr(class = 'hr'),
),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(class = "sidebar",
# ENGLISH
conditionalPanel(
condition = "input.lang == 'en'",
HTML('<p style="display:inline; color:white; font-size: 12px;">Select a category and keyword you would like to explore.</p>'),
br(),
p(),
selectInput("category1",
label = "Category",
choices = list("activities","alcohol", "arts & entertainment", "banks", "repair",
"bathroom supplies", "caffeine", "cars", "charity", "clothing stores", "computers",
"dating", "death", "delivery", "diet", "drugs", "education", "environment", "fast food restaurants",
"feelings", "festivals", "finance", "fitness", "food", "gambling", "games", "gardening", "hairstyle",
"health", "home issues", "hotel", "housing", "illnesses", "insurance", "jewelry", "job areas", "jobs",
"kitchen supplies", "learning", "makeup", "marijuana", "marketplace", "mental health", "movie genre",
"music", "news", "office supplies", "pantry", "pets", "pharmaceutical", "political parties",
"politicians & personalities","porn", "racial & ethinic minorities", "recipies", "relationship", "religion",
"retail", "retail 2", "skin care", "social media", "software", "spices", "sports", "sport teams & leagues",
"stis", "transportation", "travel", "vegetables", "wedding"
),
selected = NULL),
selectInput("keyword1",
label = "Keyword",
choices = NULL),
hr(class = 'hr'),
checkboxInput("compare","Check to compare trends across different keywords.", FALSE),
conditionalPanel(
condition = "input.compare && input.lang == 'en'",
hr(class = 'hr'),
HTML('<p style="display:inline; color:white; font-size: 12px;">Select a category and keyword you would like to compare.</p>'),
selectInput("category2",
label = "Category",
choices = list("activities","alcohol", "arts & entertainment", "banks", "repair",
"bathroom supplies", "caffeine", "cars", "charity", "clothing stores", "computers",
"dating", "death", "delivery", "diet", "drugs", "education", "environment", "fast food restaurants",
"feelings", "festivals", "finance", "fitness", "food", "gambling", "games", "gardening", "hairstyle",
"health", "home issues", "hotel", "housing", "illnesses", "insurance", "jewelry", "job areas", "jobs",
"kitchen supplies", "learning", "makeup", "marijuana", "marketplace", "mental health", "movie genre",
"music", "news", "office supplies", "pantry", "pets", "pharmaceutical", "political parties",
"politicians & personalities","porn", "racial & ethinic minorities", "recipies", "relationship", "religion",
"retail", "retail 2", "skin care", "social media", "software", "spices", "sports", "sport teams & leagues",
"stis", "transportation", "travel", "vegetables", "wedding"
),
selected = NULL),
selectInput("keyword2",
label = "Keyword",
choices = NULL),
),
hr(class = 'hr'),
p(class ='bold', "Legend"),
p('First Canada case: January 25th (blue)'),
p(),
p('First Quebec case: February 27 (violet)'),
p(),
p('Province shutdown: March 13 (red)'),
p(),
p('Gatherings permitted: May 20 (green)'),
hr(class = 'hr'),
HTML('<p style="display:inline; color:white; font-size: 12px">By: Bogdan Tanasie</p>'),
p(),
HTML('<p style="display:inline; color:white; font-size: 12px">Faculty advisor: Juan Camilo Serpa</p>'),
p(),
HTML('<p style="display:inline; color:white; font-size: 12px">Source:</p>'),
tags$a(class='refText', href="https://trends.google.com/trends/?geo=CA-QC", "https://trends.google.com/trends/?geo=CA-QC"),
p(),
HTML('<p style="display:inline; color:white; font-size: 12px">Code:</p>'),
tags$a(class='refText', href="https://github.com/bogdan-tanasie/covid_qc_trends", "https://github.com/bogdan-tanasie/covid_qc_trends"),
),
# FRENCH
conditionalPanel(
condition = "input.lang == 'fr'",
HTML('<p style="display:inline; color:white; font-size: 12px;">Sélectionnez une catégorie et un mot-clé que vous souhaitez explorer.</p>'),
p(),
selectInput("category1fr",
label = "Catégorie",
choices = list("activités","alcool", "culture & loisirs", "banques", "réparation",
"accessoires de salle de bain", "caféine", "voitures", "charité", "magasins de vêtements", "ordinateurs",
"rencontres", "mort", "livraison", "régime", "drogues", "éducation", "environment", "restauration rapide",
"emotions", "festivals", "finance", "fitness", "aliments", "jeux d'argent", "jeux", "jardinage", "coiffure",
"santé", "problèmes à la maison", "hôtel", "logement", "maladies", "assurance", "bijoux", "domaines d'emploi", "emplois",
"accessoires de cuisine", "apprendre", "maquillage", "marijuana", "marché", "santé mentale", "genre de film",
"musique", "nouvelles", "accessoires de bureau", "garde-manger", "animaux domestiques", "pharmaceutique", "partis politiques",
"politiciens et personnalités","porno", "minorités raciales et éthiniques", "recettes", "relations", "religion",
"vente au détail", "vente au détail 2", "soin de la peau", "médias sociaux", "logiciel", "épices", "sports", "équipes et ligues sportives",
"itss", "transport", "voyage", "légumes", "mariage"
),
selected = NULL),
selectInput("keyword1fr",
label = "Mot-clé",
choices = NULL),
hr(class = 'hr'),
checkboxInput("comparefr","Comparer les graphiques.", FALSE),
conditionalPanel(
condition = "input.comparefr && input.lang == 'fr'",
hr(class = 'hr'),
HTML('<p style="display:inline; color:white; font-size: 12px;">Sélectionnez une catégorie et un mot-clé que vous souhaitez comparer.</p>'),
p(),
selectInput("category2fr",
label = "Catégorie",
choices = list("activités","alcool", "culture & loisirs", "banques", "réparation",
"accessoires de salle de bain", "caféine", "voitures", "charité", "magasins de vêtements", "ordinateurs",
"rencontres", "mort", "livraison", "régime", "drogues", "éducation", "environment", "restauration rapide",
"emotions", "festivals", "finance", "fitness", "aliments", "jeux d'argent", "jeux", "jardinage", "coiffure",
"santé", "problèmes à la maison", "hôtel", "logement", "maladies", "assurance", "bijoux", "domaines d'emploi", "emplois",
"accessoires de cuisine", "apprendre", "maquillage", "marijuana", "marché", "santé mentale", "genre de film",
"musique", "nouvelles", "accessoires de bureau", "garde-manger", "animaux domestiques", "pharmaceutique", "partis politiques",
"politiciens et personnalités","porno", "minorités raciales et éthiniques", "recettes", "relations", "religion",
"vente au détail", "vente au détail 2", "soin de la peau", "médias sociaux", "logiciel", "épices", "sports", "équipes et ligues sportives",
"itss", "transport", "voyage", "légumes", "mariage"
),
selected = NULL),
selectInput("keyword2fr",
label = "Mot-clé",
choices = NULL),
),
hr(class = 'hr'),
p("Légende"),
p('Premier cas au Canada: 25 janvier (bleu)'),
p(),
p('Premier cas au Québec: 27 février (violet)'),
p(),
p('Femeture de la province: 13 mars (rouge)'),
p(),
p('Rassemblements permis: 20 may (vert)'),
hr(class = 'hr'),
HTML('<p style="display:inline; color:white; font-size: 12px">Par: Bogdan Tanasie</p>'),
p(),
HTML('<p style="display:inline; color:white; font-size: 12px">Conseiller pédagogique: Juan Camilo Serpa</p>'),
p(),
HTML('<p style="display:inline; color:white; font-size: 12px">Source:</p>'),
tags$a(class='refText', href="https://trends.google.com/trends/?geo=CA-QC", "https://trends.google.com/trends/?geo=CA-QC"),
p(),
HTML('<p style="display:inline; color:white; font-size: 12px">Code:</p>'),
tags$a(class='refText', href="https://github.com/bogdan-tanasie/covid_qc_trends", "https://github.com/bogdan-tanasie/covid_qc_trends"),
)
),
# Show a plot of the generated distribution
mainPanel(class = "main",
conditionalPanel(
condition = "input.lang == 'en'",
plotlyOutput("graph1"),
hr(class = 'hr'),
h5("Interest change after 5 days of event in ", align='center', "%"),
box(class = 'stats', uiOutput("stats1a")),
box(class = 'stats', uiOutput("stats2a")),
box(class = 'stats', uiOutput("stats3a")),
box(class = 'stats', uiOutput("stats4a")),
box(p()),
box(p()),
hr(class = 'hr'),
p(),
),
conditionalPanel(
condition = "input.compare && input.lang == 'en'",
plotlyOutput("graph2"),
hr(class = 'hr'),
h5("Interest change after 5 days of event in ", align='center', "%"),
box(class = 'stats', uiOutput("stats1b")),
box(class = 'stats', uiOutput("stats2b")),
box(class = 'stats', uiOutput("stats3b")),
box(class = 'stats', uiOutput("stats4b")),
box(p()),
box(p()),
hr(class = 'hr'),
p(),
),
conditionalPanel(
condition = "input.lang == 'fr'",
plotlyOutput("graph1fr"),
hr(class = 'hr'),
h5("Changement d'intérêt après 5 jours d'événement en ", align='center', "%"),
box(class = 'stats', uiOutput("stats1afr")),
box(class = 'stats', uiOutput("stats2afr")),
box(class = 'stats', uiOutput("stats3afr")),
box(class = 'stats', uiOutput("stats4afr")),
box(p()),
box(p()),
hr(class = 'hr'),
p(),
),
conditionalPanel(
condition = "input.comparefr && input.lang == 'fr'",
plotlyOutput("graph2fr"),
hr(class = 'hr'),
h5("Changement d'intérêt après 5 jours d'événement en ", align='center', "%"),
box(class = 'stats', uiOutput("stats1bfr")),
box(class = 'stats', uiOutput("stats2bfr")),
box(class = 'stats', uiOutput("stats3bfr")),
box(class = 'stats', uiOutput("stats4bfr")),
box(p()),
box(p()),
hr(class = 'hr'),
p(),
),
)
)
)