-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.R
More file actions
54 lines (47 loc) · 1.53 KB
/
Copy pathapp.R
File metadata and controls
54 lines (47 loc) · 1.53 KB
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
# Instala y carga los paquetes necesarios
if (!require("shiny")) install.packages("shiny")
if (!require("shinydashboard")) install.packages("shinydashboard")
library(shiny)
library(shinydashboard)
if(!exists("gas_station_data_loaded")){
source("GasStation_dataset_load.R")
}
source("app_choropleth_map.R")
source("app_grouped_bar.R")
source("app_line_chart.R")
# Define la interfaz de usuario
ui <- dashboardPage(
dashboardHeader(title = "Fuel prices in Spain"),
dashboardSidebar(
sidebarMenu(
menuItem("Price per province", tabName = "app1", icon = icon("map")),
menuItem("Price over the time", tabName = "app2", icon = icon("line-chart")),
menuItem("Price per road type", tabName = "app3", icon = icon("bar-chart"))
)
),
dashboardBody(
tags$style(type = "text/css", "#map {height: calc(100vh - 160px) !important;}"),
tags$style(type = "text/css", "#barChart {height: calc(100vh - 160px) !important;}"),
tags$style(type = "text/css", "#lineChart {height: calc(100vh - 160px) !important;}"),
tabItems(
tabItem(tabName = "app1",
app1$ui
),
tabItem(tabName = "app2",
app2$ui
),
tabItem(tabName = "app3",
app3$ui
)
)
)
)
# Define el servidor
server <- function(input, output) {
# Llama a las funciones del servidor de cada aplicación
app1$server(input, output)
app2$server(input, output)
app3$server(input, output)
}
# Ejecuta la aplicación
shinyApp(ui = ui, server = server)