-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathui.R
135 lines (124 loc) · 7.69 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
# -------------- ui file has to load the libraries as well for successfull running on server -----
#packages <- c("here", "shiny", sf", "tmap", "tmaptools", "ggplot2", "dplyr", "shinydashboard", "leaflet")
#lapply(packages, require, character.only = T)
library(dplyr)
library(ggplot2)
library(here)
library(sf)
library(leaflet)
library(shiny)
library(shinydashboard)
library(tmap)
library(tmaptools)
# -------------------------------------------- create ui ----------------------------------------
ui <- dashboardPage(
dashboardHeader(title = "Dashboard"),
dashboardSidebar(
sidebarMenu(
menuItem("Data Explorer", tabName = "data_explorer", icon = icon("th")),
menuItem("Storyboard", tabName = "storyboard", icon = icon("dashboard")),
menuItem("Reference", tabName = "reference", icon = icon("th"))
)
),
dashboardBody(
tabItems(
# ---------------------------- First tab content "German Power Plant Data Explorer" ----
tabItem(tabName = "data_explorer",
fluidRow(
column(width = 4,
fluidRow(
column(width = 12,
h3("German Power Plants Explorer", align = "center"),
#titlePanel("German Power Plants Explorer"),
sidebarPanel(width = 12,
selectInput('source', 'Energy Source', c("All" = "All", "Solar Energy" = "Solareinheit", "Wind Energy" = "Windeinheit",
"Biomass Energy" = "Biomasse", "Water Energy" = "Wasser",
"Brown Coal Energy" = "Braunkohle", "Black Coal Energy" = "Steinkohle",
"Gas Energy" = "Gas", "Mineral Oil Energy" = "Mineralölprodukte",
"Battery" = "Stromspeichereinheit", "Geothermal Energy" = "Geothermie")),
selectInput('geo_level', 'Geographical Level', c("State" = "state", "County" = "county")),
selectInput('out_var', 'Output Variable', c("Number of power plants" = "n",
"Sum of power production" = "sum",
"Average power production per plant" = "mean" )),
selectInput('tmap_scale', "Scale for the Map", c("linear" = "pretty",
"logarithmic" = "log10")),
sliderInput("scale", "Rough Number of Legend Classes",
min = 2, max = 10, value = 6),
sliderInput("years", "Period of interest for yearly change",
min = 1970, max = 2019, value = c(2000, 2019)),
# Button
downloadButton("downloadData", "Download Data")
)
)
)
),
column(width = 8,
fluidRow(
column(width = 12,
h3("Germany in geographical zones"),
leafletOutput('map')
)
),
fluidRow(
column(width = 12,
h3("Yearly change (flow variable): ", textOutput("title_change_over_time")),
plotOutput('plot_change_over_time'),
h3("Comparison of energy sources for this region (stock variable)"),
plotOutput('plot_energy_bar_chart')
)
)
)
)
),
# ---------------------------- Second tab content: Storyboard --------------------
tabItem(tabName = "storyboard",
h2("Would you like to participate in adventurous stories?\nJoin our R-Force!"),
#br(),
div(class = "text",
p("We have connected the data on energy production in Germany to publicly available regional data at state and county level. So far we have some ideas which stories we could tell and are very open to your suggestions and your support!"),
p(tags$b("Do rich regions in Germany have more solar power plants?")),
p(tags$b("Do rich regions in Germany have larger solar power plants?"))
#p("Are voting results related to protests against wind power plants?"),
#p("Which questions would you like to explore?")
),
br(),
# ----------------------- First story: Income and Solar plants ------------
h3("Income and Solar Plants at state level"),
h4("Average yearly income and total amount of solar power plants"),
br(),
plotOutput("plot_state_income_n"),
br(),
br(),
br(),
h4("Average yearly income and mean power of plant in Watt"),
br(),
plotOutput("plot_state_income_mean"),
br(),
br(),
h3("Income and Solar Plants at county level"),
h4("Average yearly income and total amount of solar power plants"),
br(),
plotOutput("plot_county_income_n"),
br(),
br(),
br(),
h4("Average yearly income and mean power of plant in Watt"),
br(),
plotOutput("plot_county_income_mean")
),
# ----------------------------------- Third tab content: References ------------------------
tabItem(tabName = "reference",
h2("Reference"),
div(class = "list",
tags$ul(
tags$li(tags$b("Data"), ": German power plants raw data is downloaded from official register", tags$a(href="https://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Energie/Unternehmen_Institutionen/ErneuerbareEnergien/ZahlenDatenInformationen/VOeFF_Registerdaten/DatenAb310119.zip", "Marktstammdatenregister."),"\n",
"Moreover, the geospatial information relies on data provided by the ", tags$a(href="http://www.bkg.bund.de", "Bundesrepublick Deutschland.")),
p("The source provides more than 100 variables for various purposes and we have only used a few of them."),
tags$li(tags$b("License"), ": Term of use of MaStR data is subject to", tags$a(href="http://www.gesetze-im-internet.de/mastrv/index.html", "Ordinance on the central electronic directory of energy management data"), "under", tags$a(href="http://www.gesetze-im-internet.de/mastrv/__15.html","Section 15 Public Accessibility of the Data"), "and", tags$a(href="http://www.gesetze-im-internet.de/mastrv/__20.html", "Section 20 Terms of Use."),"\n",
"License of geospatial data according to ", tags$a(href="https://www.govdata.de/dl-de/by-2-0", "dl-de-by-2.0."))
)
)
)
)
)
)