Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R Shiny input slider range values

I have a slider input type of 'range' in my Shiny app and I would like to get the minimum and maximum values selected by the user in my server.R

in my ui.R I have

sliderInput("range", "Age:",
min = 0, max = 100, value = c(0,100))

and I would like to get the selected values not min and max that I have defined

like image 518
ElOwner Avatar asked Jul 04 '16 09:07

ElOwner


Video Answer


1 Answers

You can access the slider ranges using input$range[1] for min and input$range[2] for max

library(shiny)

ui <- basicPage(sliderInput("range", "Age:",min = 0, max = 100, value = c(0,100)),textOutput("SliderText"))
server <- shinyServer(function(input, output, session){
  my_range <- reactive({
    cbind(input$range[1],input$range[2])
})
output$SliderText <- renderText({my_range()})
})
shinyApp(ui = ui, server = server)

enter image description here

like image 60
Pork Chop Avatar answered Sep 26 '22 19:09

Pork Chop