Ниже моя функция пользовательского интерфейса во Flexdashboard. Но когда я пытаюсь установить диапазон дат, я не выхожу. Ниже приведен пример фрейма данных
df
Date Variable
21-09-2017 22:05:00 A
22-09-2017 22:05:00 B
23-09-2017 22:05:00 C
24-09-2017 22:05:00 D
24-09-2017 22:05:00 E
Функция фильтра ниже. (Не уверен, что я делаю здесь, в функции фильтра. Мне нужны переменная и дата в фильтрах
output$g1 <- renderPlotly({
req(input$Plot1)
if (input$Plot1 == "Trend") {
plot_data <- df
}
if (input$Plot1 == "Trend" & input$b != "All" & input$s2 != NULL) {
#plot_data <- df %>% filter(variable == input$b)
plot_data <- df[df$variable %in% input$b & df$Date %in% input$s2,]
}
UIфункция ниже
selectInput("Plot1","Filter1",choices = c("","Trend","Correlation"))
output$filter_2 <- renderUI({
if (input$Plot1 == "") {
return()
} else if (input$Plot1 == "Trend") {
label = "Trend"
selectInput("b",label,choices = c("All",levels(factor(df$variable))),multiple = TRUE)
} else {
label = "First Variable"
selectInput("b",
label,
choices = c(levels(factor(df$variable))))
}
})
uiOutput("filter_2")
uiOutput("filter_4")
output$filter_4 <- renderUI({
if(input$Plot1 == "Trend"){
dateRangeInput("s2","Date",min = min(df$Date),max = max(df$Date))
} else if(input$Plot1 == "Correlation"){
dateRangeInput("s2","Date",min = min(df$Date),max = max(df$Date))
}
})