library(shiny)
library(shinydashboard)
library(ggplot2)
library(lubridate)
library(dplyr)
data <- readRDS("data_ready.rds")
data$date <- as.Date(data$date)
ui <- dashboardPage(
dashboardHeader(title = "Basic dashboard"),
dashboardSidebar(
sliderInput( inputId = "slide",
label = "Choose number bins:",
min=10,
max=50,
value = 25
),
dateRangeInput("dates",
"Select Dates",
start = min(data$date), end = max(data$date))
)
,
dashboardBody(
# Boxes need to be put in a row (or column)
box(plotOutput(outputId = "output_name")),
box(plotOutput(outputId = "output_name2"))
)
)
server <- function(input, output) {
output$output_name <- renderPlot({
data <- data[ data$date >= input$dates[1] & data$date <= input$dates[2], ]
ggplot(data = data) + geom_line(aes(x = date, y = ActiveEnergy_avg))})
output$output_name2 <- renderPlot({hist(data$ActiveEnergy_avg, breaks = input$slide)})
}
shinyApp(ui, server)
Shiny applications not supported in static R Markdown documents