闪亮的滑块适用于数字范围,但不适用于日期
Shiny slider works for numeric ranges, but not for dates
Shiny 滑块似乎不适用于我的日期,但它们可以很好地处理数字。这有效:
library(shiny)
ui <- fluidPage(
sliderInput("range", "Range", min = 0, max = 10, value = c(2, 4)) )
shinyApp(ui, function(...) {})
Screenshot of slider with numeric values
这不是:
library(shiny)
ui <- fluidPage(
sliderInput("range", "Range", min = as.Date("2021-01-01"), max = as.Date("2021-12-31"), value = c(as.Date("2021-02-02"), as.Date("2021-03-03")))
)
shinyApp(ui, function(...) {})
它只是产生一个空白框:
Screenshot of blank box
非常感谢任何建议。
您的代码运行良好:
library(shiny)
ui <- fluidPage(sliderInput(
inputId = "range",
label = "Range",
min = as.Date("2021-01-01"),
max = as.Date("2021-12-31"),
value = c(as.Date("2021-02-02"), as.Date("2021-03-03"))
))
server <- function(input, output, session) {}
shinyApp(ui, server)
Shiny 滑块似乎不适用于我的日期,但它们可以很好地处理数字。这有效:
library(shiny)
ui <- fluidPage(
sliderInput("range", "Range", min = 0, max = 10, value = c(2, 4)) )
shinyApp(ui, function(...) {})
Screenshot of slider with numeric values
这不是:
library(shiny)
ui <- fluidPage(
sliderInput("range", "Range", min = as.Date("2021-01-01"), max = as.Date("2021-12-31"), value = c(as.Date("2021-02-02"), as.Date("2021-03-03")))
)
shinyApp(ui, function(...) {})
它只是产生一个空白框:
Screenshot of blank box
非常感谢任何建议。
您的代码运行良好:
library(shiny)
ui <- fluidPage(sliderInput(
inputId = "range",
label = "Range",
min = as.Date("2021-01-01"),
max = as.Date("2021-12-31"),
value = c(as.Date("2021-02-02"), as.Date("2021-03-03"))
))
server <- function(input, output, session) {}
shinyApp(ui, server)