0
我的數據幀如下:updateSliderInput與閃亮的應用遺漏值
df <- structure(list(id = c(358L, 362L, 363L, 366L, 369L), Time_of_visit = c("DAY",
"DAY", "DAY", "DAY", "DAY"), PropertyCode = c(7627, 7627, 7627,
7627, 7627)), .Names = c("id", "Time_of_visit", "PropertyCode"
), row.names = c(61L, 65L, 66L, 69L, 72L), class = "data.frame")
它看起來像這樣:
id Time_of_visit PropertyCode
61 358 DAY 7627
65 362 DAY 7627
66 363 DAY 7627
69 366 DAY 7627
72 369 DAY 7627
我創建一個sliderInput動態取ID列的值並允許用戶滑過。 id列的值很少是順序的。當我運行滑塊時,我得到滑塊,但滑塊中的值以小數形式增加。如何直接跳轉從358滑塊362或366到369。到目前爲止我的代碼看起來是這樣的:
library(shiny)
ui <- fluidPage(
sliderInput('myslider','PICTURES',min = 0, max = 1, value = 1,step = NULL, animate=animationOptions(interval = 1000,loop=F))
)
server <- function(input, output, session) {
dff <- reactive({df})
observe({
updateSliderInput(session, "myslider", label = "PICTURES", value = 1,step = NULL,min = min(dff()$id), max = max(dff()$id))
})
}
shinyApp(ui = ui, server = server)
我不知道,如果最小值和最大值或步長值應改變。有什麼想法嗎?
Beakovic工作得很好。非常感謝。 – Apricot