library(shiny)
# ui.R
ui <- shinyUI(fluidPage(
title = 'Initial run of time range update breaks sliderInput',
fluidRow(
column(width = 100,
sliderInput("timeRange", label = "Time range",
min = as.POSIXct("2011-06-04 12:00:00"),
max = as.POSIXct("2011-08-10 14:00:00"),
value = c(as.POSIXct("2011-06-04 12:00:00"),
as.POSIXct("2011-08-10 14:00:00"))),
actionButton("update", "Update range")
)
)))
server <- shinyServer(function(input, output, session) {
output$from <- renderText(input$timeRange[1]);
output$to <- renderText(input$timeRange[2]);
observe({
input$update;
updateSliderInput(session, "timeRange", value =
c(as.POSIXct("2011-06-14
12:00:00"), as.POSIXct("2011-08-01 14:00:00")));
})
})
runApp(list(ui = ui,server = server))
上面是代码。我想制作滑块,使每一步都会增加或减少6个小时。
我应该将sliderInput函数的“ step”参数设置为什么?