I have set up a small app to pass selected dateRange variables and show the selected dates in the main panel. Everything seem to run with no errors, but I get no output. As I am very new to this environment I am sure I am just doing some basic thin wrong but have looked at it for hours now and do not see my mistake.
This reads in a csv file as it's data source. Here is a sample of that data:
oid , sid , otime , s1 , s2 , s5 , s7 , s8
1 , E26 , 2018-08-20 00:00:00 , 47.85 , 0 , 47.25 , 50.05 , 44.8
1 , E26 , 2018-08-20 00:00:30 , 47.55 , 0 , 47.3 , 50.15 , 45
1 , E26 , 2018-08-20 00:01:00 , 47.7 , 0 , 47.6 , 50.2 , 45.1
1 , E26 , 2018-08-20 00:01:30 , 47.75 , 0 , 47.55 , 50.3 , 45.2
1 , E26 , 2018-08-20 00:02:00 , 47.95 , 0 , 47.35 , 50.2 , 45.1
1 , E26 , 2018-08-20 00:02:30 , 47.95 , 0 , 47.1 , 50.2 , 44.9
1 , E26 , 2018-08-20 00:03:00 , 48 , 0 , 47.1 , 50.25 , 45
1 , E26 , 2018-08-20 00:03:30 , 48.25 , 0 , 47.15 , 50.4 , 45.05
1 , E26 , 2018-08-20 00:04:00 , 48 , 0 , 47.15 , 50.4 , 45.2
the data and date conversion seem to work well but I lose sight of anything else.
Any help is appreciated.
Here is my code. There is not very much of it:
library(shiny)
library(dplyr)
s_data <- read.csv('s_data.txt', header = TRUE, stringsAsFactors = FALSE)
str(s_data)
s_data$otime = as.Date(s_data$otime, format("%Y-%m-%d %H:%M:%S"))
ui <- fluidPage(
titlePanel("GNSS GPS Observation Data"),
sidebarLayout(
sidebarPanel(
dateRangeInput("dateRange", "Select Dates",
start = min(s_data$otime),
end = max(s_data$otime),
min = min(s_data$otime),
max = min(s_data$otime),
format = "dd/mm/yyyy",
separator = "-"
),
mainPanel(
textOutput("startdate"),
textOutput("enddate"),
textOutput("range"),
tableOutput("subdata")
)
)
)
server <- function(input, output) {
output$startdate <- renderText({as.character(input$dateRange[1])
})
output$enddate <- renderText({as.character(input$dateRange[2])
})
output$range <- renderText({paste(as.character("Selected date range: ", input$dateRange[1], " to ", input$dateRange[2]))
})
output$subData <- renderTable({
s = subset(s_data,s_data$otime >= input$dateRange[1] & input$dateRange[2])
table(s.s1)
})
}
shinyApp(ui = ui, server = server)