-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.R
192 lines (183 loc) · 11.7 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
library(shiny)
library(eurostat)
library(shinyWidgets)
library(dplyr)
library(plotly)
library(bslib)
# Read eurostat_countries dataframe
eu_areas <- data.frame(code = c("EU", "EA"), name = c("European union", "Euro area"), label = c("European union", "Euro area"))
eurostat_countries <- rbind(eu_countries, efta_countries, eu_areas) %>%
select(code, name) %>% arrange(name) %>%
filter(name != "Liechtenstein")
ui <- fluidPage(theme = bs_theme(bootswatch = "minty"),
tags$style(HTML("
.navbar {
min-height: 15px;
padding-top: 0px;
padding-bottom: 0px;
}
.navbar-brand {
padding-top: 0px;
padding-bottom: 0px;
}
.nav-link {
padding-top: 3px;
padding-bottom: 3px;
}
.plot-container .legend .traces .legendtext {
white-space: normal !important;
word-break: break-word !important;
}
")),
tags$div(
tags$h1("HICP Voyager 1.5", style = "text-align: left; margin-bottom: 10px; margin-top: 10px;font-size: 20px;")
),
navbarPage(
title = "",
tabPanel("Index",
fluidRow(
column(width = 3,
selectInput("countries", "Select countries:", choices = setNames(eurostat_countries$code, eurostat_countries$name), multiple = TRUE),
selectInput("coicops", "Select product categories:", choices = setNames(coicop_set$coicop_code, coicop_set$code_label), multiple = TRUE),
actionButton("update", "Retrieve data"),
br(),
p(" "),
br(),
radioButtons("period_type", "Index reference period:", choices = c("Full year", "Month"), selected = "Full year"),
p(" "),
condition = "update",selectInput("select_years", "Select index reference period:", choices = "", multiple = FALSE),
actionButton("rebase", "Update plot"),
br(),
p(" "),
br(),
conditionalPanel(
condition = "output.plot",
downloadLink('downloadData', 'Download data')
)
),
column(width = 8, div(style = "max-width: 700px; width: 100%;",
plotlyOutput("plot")))
)
),
tabPanel("M/M-1",
fluidRow(
column(width = 3,
selectInput("countries_mr", "Select countries:", choices = setNames(eurostat_countries$code, eurostat_countries$name), multiple = TRUE),
selectInput("coicop_mr", "Select product category:", choices = setNames(label_set$coicop_code, label_set$code_label), multiple = FALSE),
br(),
radioButtons("contribution_type", "Contribution to", choices = c("selected higher aggregate", "all-items HICP"), selected = "selected higher aggregate"),
br(),
actionButton("update_mr", "Retrieve data"),
br(),
br(),
selectInput("select_period_mr", "Select months to compare:", choices = "", multiple = TRUE),
p(" "),
#conditionalPanel(
# condition = "output.plot_mr",
# sliderInput("range_slider_m", "Select period:", min = 2000, max = 2023, value = c(2015, 2023), ticks=FALSE, sep="")),
p(" "),
br(),
p(" "),
br(),
conditionalPanel(
condition = "output.plot_mr",
downloadLink('downloadData_mr', 'Download data')
)
),
column(width = 8,
plotlyOutput("plot_mr")
)
)
),
tabPanel("M/M-12",
fluidRow(
column(width =3,
selectInput("countries_ar", "Select countries:", choices = setNames(eurostat_countries$code, eurostat_countries$name), multiple = TRUE),
selectInput("coicop_ar", "Select product category:", choices = setNames(label_set$coicop_code, label_set$code_label), multiple = FALSE),
br(),
radioButtons("contribution_type_ar", "Contribution to", choices = c("selected higher aggregate", "all-items HICP"), selected = "selected higher aggregate"),
br(),
actionButton("update_ar", "Retrieve data"),
br(),
br(),
p(" "),
conditionalPanel(
condition = "output.plot_ar",
sliderInput("range_slider", "Select period:", min = 2000, max = 2023, value = c(2015, 2023), ticks=FALSE, sep="")),
p(" "),
br(),
p(" "),
br(),
conditionalPanel(
condition = "output.plot_ar",
downloadLink('downloadData_ar', 'Download data')
)
),
column(width = 8,
plotlyOutput("plot_ar")
)
)
),
tabPanel("Seasonality",
fluidRow(
column(width =3,
selectInput("countries_se", "Select countries:", choices = setNames(eurostat_countries$code, eurostat_countries$name), multiple = TRUE),
selectInput("coicop_se", "Select product category:", choices = setNames(coicop_set$coicop_code, coicop_set$code_label), multiple = FALSE),
br(),
actionButton("update_se", "Retrieve data"),
br(),
br(),
p(" "),
br(),
selectInput("select_years_se", "Select years to compare:", choices = "", multiple = TRUE),
p(" "),
br(),
p(" "),
br(),
conditionalPanel(
condition = "output.plot_se",
downloadLink('downloadData_se', 'Download data')
)
),
column(width = 8,
plotlyOutput("plot_se")
)
)
),
tabPanel("Weights",
fluidRow(
column(width = 3,
selectInput("countries_w", "Select countries:", choices = setNames(eurostat_countries$code, eurostat_countries$name), multiple = TRUE),
selectInput("coicop_w", "Select product category:", choices = setNames(label_set$coicop_code, label_set$code_label), multiple = FALSE),
actionButton("update_w", "Retrieve data"),
br(),
p(" "),
p(" "),
conditionalPanel(
condition = "output.plot_w",
sliderInput("range_slider_w", "Select period:", min = 2000, max = 2023, value = c(2015, 2023), ticks=FALSE, sep="")),
p(" "),
br(),
p(" "),
br(),
conditionalPanel(
condition = "output.plot_w",
downloadLink('downloadData_w', 'Download data')
)
),
column(width = 8,
plotlyOutput("plot_w")
)
)
),
tabPanel("Help",
h5("Navigate seamlessly in the universe of european price statistics"),
br(),p("This app enables to produce graphs for the all-items level or any subcomponent(s) in the european HICP (Harmonized Index of Consumer Prices). Currently graphs for indices, monthly rates, annual rates, seasonality and weights can be produced.",
br(),p(" "),"For the Index tab, users can set a new reference period (month or year), common for all selected index series.",br(),p(" "),
p(" "),"For the Seasonality tab, indices with December previous year = 100 are produced.",br(),p(" "),
"For the M/M-12 (annual rates of change) and M/M-1 (monthly rates of change), Ribe contributions are calculated for the level directly below the selected aggregate (following formula in Eurostat's HICP Methodological manual, p 182-183). The Ribe contribution is also described in"),
HTML('<a href="https://www.oecd.org/sdd/prices-ppp/OECD-calculation-contributions-annual-inflation.pdf"), target="_blank">https://www.oecd.org/sdd/prices-ppp/OECD-calculation-contributions-annual-inflation.pdf</a>'),
br(),p(" "), "Data is retrieved using the 'eurostat' package from the Eurostat HICP database. Additional calculations are performed where needed."
)
)
)