My data frame is as follows:
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")
It looks like this:
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
I am creating a sliderInput that dynamically takes the value of the id column and allows the users to slide through. The values of id column are rarely sequential. When I run the slider, I get the slider, but the values in the slider increases in decimals. How do I directly jump the slider from 358 to 362 or 366 to 369. My code so far looks like this:
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)
I am not sure, if the min and max values or the step values should be be changed. Any thoughts?