Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Setting slider in Shiny

I am trying to set slider in Shiny. Below you can see my code :

 column(2,
         h4("Baseline-t0"),
         sliderInput("simulationSlider1", "Base Year",
         min = 2022, max = 2023, step = 1, value = 2022, width = "100%", round = 0),
                           ),

This code produce slider as is shown in the figure below :

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Instead of integer numbers, on this slider I can see figure such as 2,022 and 2,023.Can anybody help me how I can set slider to show me integer number such as 2022 and 2023 ?

>Solution :

You can change the sep in the sliderInput, which is sep = "," as default. A fully reproducible example is below:

ui <- fluidPage(
  sliderInput("simulationSlider1", "Base Year",
              min = 2022, max = 2023, step = 1, 
              value = 2022, width = "100%", 
              round = 0, sep = ""),
  plotOutput("distPlot")
)

server <- function(input, output) {
  output$distPlot <- renderPlot({
    hist(rnorm(input$simulationSlider1))
  })
}

shinyApp(ui, server)

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading