this part of my program needs to have two inputs 1) the user and 2) the date range selected affect the displayed plot output. Right now, the displayed plot output is just blank. There are no errors listed in my console.
My csv file has the "Date" Column in the format: 03/14/12.
Thank you for any help or observations.
library(shinydashboard)
library(shiny)
library(ggplot2)
library(gridExtra)
library(dplyr)
library(tidyverse)
library(lubridate)
ui <- dashboardPage(
dashboardHeader(title = "T"),
dashboardSidebar(),
dashboardBody(
fluidRow(
box(
title = "Controls",
selectInput("User",
"User:",
c("All",
unique(as.character(df$User))))
),
box(
dateRangeInput("dates",
"Date range",
start = "01-01-2018",
end = "06-25-2018")
),
mainPanel(
tabsetPanel(type = "tabs",
tabPanel("Plot", plotOutput("plot")
)
)
)
)
)
)
server <- function(input, output){
df <- read.csv(file = "c:/T/T/T.csv", header = TRUE, sep = ",")
df$Date <- as.Date(df$Date)
begin<- reactive({input$dates[1]})
finish<- reactive({input$dates[2]})
output$plot <- renderPlot({
df.filtered <- df %>%
filter(df$User == input$User) %>%
filter(Date >= begin(), Date <= finish())
req(df.filtered)
df.filtered %>%
ggplot(aes(DfM, SvM, colour = User)) +
geom_point(show.legend = FALSE) +
directlabels::geom_dl(aes(label = User), method = "smart.grid")
shinyApp(ui, server)