title: Shiny app with two sliders: second slider is only selecting the endpoints, not range
body: <p>I have written the following <code>R Shiny</code> app.  The user selects <code>farm</code> from a drop-down menu and a single value of <code>year</code> from a <code>slider</code>.  I would like the user to be able to select a <code>range</code> of values for <code>month</code>, but the second <code>slider</code> is only selecting the end points of <code>month</code>, not the <code>range</code>.</p>
  
  <p>Here is what the <code>month</code> <code>slider</code> is selecting, as an example with <code>farm == 1</code> and <code>year == 2</code> from the <code>data.frame fruit</code> created within the <code>app</code> below:</p>
  
  <pre><code>&gt; fruit[fruit$farm == 1 &amp; fruit$year == 2 &amp; fruit$month %in% c(4,9),]
     farm year month   apples cherries
  16    1    2     4 70.23774 82.18512
  21    1    2     9 38.99675 66.07546
  </code></pre>
  
  <p>Here is what I would like the <code>month</code> <code>slider</code> to select:</p>
  
  <pre><code>&gt; fruit[fruit$farm == 1 &amp; fruit$year == 2 &amp; fruit$month %in% c(4:9),]
     farm year month   apples cherries
  16    1    2     4 70.23774 82.18512
  17    1    2     5 37.17340 83.47027
  18    1    2     6 36.00925 73.27322
  19    1    2     7 31.20337 98.30440
  20    1    2     8 33.93355 63.92046
  21    1    2     9 38.99675 66.07546
  </code></pre>
  
  <p>How can I modify this code so all selected months are included in the resulting <code>plot</code>?  Here is my <code>Shiny</code> app:</p>
  
  <pre><code>library(shiny)
  
  set.seed(1234)
  
  n.farms &lt;- 5
  n.years &lt;- 3
  
  fruit &lt;- data.frame(
          farm = rep(1:n.farms, each = 12*n.years),
          year = rep(rep(1:n.years, each = 12), n.farms),
         month = rep(1:12,n.farms * n.years),
        apples = runif(n.farms*12*n.years, 20, 80),
      cherries = runif(n.farms*12*n.years, 0, 100)
  )
  
  ui &lt;- fluidPage(
      titlePanel("Subset and Plot Fruit Data"),
      sidebarLayout(
          sidebarPanel(
              selectInput("codeInput1", label = "Choose Farm", choices = unique(fruit$farm)),
  
              sliderInput("codeInput2", label = "Select Year", 
                                        min = min(fruit$year), max = max(fruit$year), 
                                        value = median(fruit$year), step = 1),
  
              sliderInput("codeInput3", label = "Select Month Range", 
                                        min = min(fruit$month), max = max(fruit$month), 
                                        value = unique(fruit$month)[c(4,9)], step = 1)
          ),
          mainPanel(
              plotOutput("view")
          )
      )
  )
  
  server &lt;- function(input, output) {
  
      dataset &lt;- reactive({
          return(subset(fruit, (farm   ==  input$codeInput1 &amp; 
                                year   ==  input$codeInput2 &amp; 
                                month %in% input$codeInput3)))
      })
  
      output$view &lt;- renderPlot(plot(dataset()$apples, dataset()$cherries))
  
  }
  
  shinyApp(ui = ui, server = server)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/QzZDo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QzZDo.png" alt="enter image description here"></a></p>