Commit 478c5cdb authored by Matteo DE FELICE's avatar Matteo DE FELICE

Added the sorting of Excel files

parent 28bac642
shinyServer(function(input, output, session) {
output$zone_selection <- renderUI({
zones = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'LMP') %>%
zones = readxl::read_xlsx(paste0('', input$result_xls), sheet = 'LMP') %>%
names()
selectInput('zone', 'Choose the zone:',
choices = zones[-1])
})
output$main_plot <- renderPlot({
res = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'Reservoirs') %>%
res = readxl::read_xlsx(paste0('', input$result_xls), sheet = 'Reservoirs') %>%
mutate(date = seq(as_datetime('2016-01-01'), by = 'day', length.out = n()))
hrgen = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'Hydro power generation') %>%
hrgen = readxl::read_xlsx(paste0('', input$result_xls), sheet = 'Hydro power generation') %>%
mutate(date = seq(as_datetime('2016-01-01'), by = 'day', length.out = n()))
gen = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'Generation') %>%
gen = readxl::read_xlsx(paste0('', input$result_xls), sheet = 'Generation') %>%
mutate(date = seq(as_datetime('2016-01-01'), by = 'day', length.out = n()))
wv = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'Water value') %>%
wv = readxl::read_xlsx(paste0('', input$result_xls), sheet = 'Water value') %>%
mutate(date = seq(as_datetime('2016-01-01'), by = 'day', length.out = n()))
pf = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'Power flow') %>%
pf = readxl::read_xlsx(paste0('', input$result_xls), sheet = 'Power flow') %>%
mutate(date = seq(as_datetime('2016-01-01'), by = 'day', length.out = n()))
# Load ENTSOE Data
entsoe_storage = read_rds('data/ENTSOE-Storage-2015-2018.rds')
......
......@@ -2,6 +2,13 @@ library(shiny)
library(tidyverse)
library(readxl)
library(lubridate)
get_ordered_files <- function(variables) {
details = file.info(list.files('xls/', pattern = 'xlsx', full.names = TRUE))
details = details[with(details, order(as.POSIXct(mtime), decreasing = TRUE)), ]
files = rownames(details)
return(files)
}
shinyUI( fluidPage(
# Application title
......@@ -11,7 +18,9 @@ shinyUI( fluidPage(
sidebarLayout(
sidebarPanel(
selectInput("result_xls", "Choose a result file:",
choices = list.files('xls/', pattern = 'xlsx')),
# choices = list.files('xls/', pattern = 'xlsx')
choices = get_ordered_files()
),
selectInput('plot_type', 'Choose the plot type:',
choices = c('average water value' = 'awv',
'heatmap water value' = 'hwv',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment