title: Shiny Leaflet map with reactive slider input
body: <p>I have a dataset looking something like this:</p>
  <pre><code>Dataset &lt;- data.frame(
    &quot;Type&quot; = c(&quot;A&quot;, &quot;B&quot;, &quot;A&quot;, &quot;B&quot;),
    &quot;Value&quot; = c(1000000, 200, 4000000, 150),
    &quot;Lat&quot; = c(40.7, 41.8, 42.4, 43.1), 
    &quot;Long&quot; = c(-3.2, -2.1, -1.6, -3.1)
  )
  </code></pre>
  <pre><code>Type    Value   Lat   Long
   A     1000000  40.7  -3.2
   B       200    41.8  -2.1
   A     4000000  42.4  -1.6
   B       150    43.1  -3.1
  </code></pre>
  <p>I'm displaying each point as a marker in a leaflet map using <code>Lat</code> and <code>Long</code> as coordinates, but as you can see the <code>Value</code> range varies a lot depending on <code>Type</code>. To make my map more user-friendly I enabled a <code>pickerInput()</code> to let me choose the <code>Type</code> to be displayed on the map and then a <code>sliderInput()</code> to choose the <code>Value</code>. Using <code>reactive()</code> I filter the points for the map.</p>
  <p>My problem is that I'm unable to make a reactive <code>sliderInput()</code> range depending on the <code>Type</code> selected in <code>pickerInput</code>. I only managed to get a slider covering the whole range, which in the example data above would be from 150 to 4000000.</p>
  <p>I would need to get a slider from 150 to 200 and from 1000000 to 4000000 depending on the <code>pickerInput</code>. My code so far:</p>
  <pre><code>library(shiny)
  library(shinyWidgets)
  library(dplyr)
  library(leaflet)
  
  ui &lt;- bootstrapPage(
    absolutePanel(top = 10, right = 10,
     sliderInput(&quot;range&quot;, &quot;Value&quot;, min(Dataset$Value, na.rm = TRUE), max(Dataset$Value, na.rm = TRUE),
        value = range(Dataset$Value, na.rm = FALSE), step = 1000),
      pickerInput(&quot;Type&quot;, &quot;Type&quot;, choices = c(&quot;A&quot;, &quot;B&quot;),      selected = c(&quot;A&quot;, &quot;B&quot;), multiple = T, options = list(`actions-box` = TRUE)),
    ),
    leafletOutput(&quot;map&quot;, width = &quot;50%&quot;)
  )
  
  server &lt;- function(input, output) {
    
    filteredData &lt;- reactive({
      Dataset %&gt;% 
      filter(Type %in% input$Type) %&gt;%
      filter(Value &gt;= input$range[1]) %&gt;% 
      filter(Value &lt;= input$range[2])
   })
  
    output$map &lt;- renderLeaflet({
      leaflet(Dataset) %&gt;% addTiles() %&gt;% addMarkers(data = filteredData(), lng = ~Long, lat = ~Lat)
    })
  }
  
  shinyApp(ui, server)
  </code></pre>