title: R Shiny Make slider value dynamic
body: <p>I've got a dropdown selector and a slider scale. I want to render a plot with the drop down selector being the source of data. - I've got this part working</p>
  
  <p>I simply want the slider's max value to change based on which dataset is selected. </p>
  
  <p>Any suggestions?</p>
  
  <p><strong>server.R</strong></p>
  
  <pre><code>library(shiny)
  shinyServer(function(input, output) {
  
  source("profile_plot.R")
  load("test.Rdata")
  
  output$distPlot &lt;- renderPlot({
    if(input$selection == "raw") {
      plot_data &lt;- as.matrix(obatch[1:input$probes,1:36])
    } else if(input$selection == "normalised") {
    plot_data &lt;- as.matrix(eset.spike[1:input$probes,1:36])
    } 
  
    plot_profile(plot_data, treatments = treatment, sep = TRUE)
    })
  })
  </code></pre>
  
  <p><strong>ui.R</strong>
      library(shiny)</p>
  
  <pre><code>shinyUI(fluidPage(
    titlePanel("Profile Plot"),
  
    sidebarLayout(
      sidebarPanel(width=3,
      selectInput("selection", "Choose a dataset:", 
                   choices=c('raw', 'normalised')),
      hr(),
      sliderInput("probes",
                "Number of probes:",
                min = 2,
                max = 3540,
                value = 10)
      ),
      mainPanel(
        plotOutput("distPlot")
      )
    )
  ))
  </code></pre>