title: R reactive histogram
body: <p>I am learning the <code>Shiny</code> interface for <code>R</code> and working through the first example. </p>
  
  <p>The histogram changes based on the slider input. How do I have it update continuously, while the slider is moving? Right now, it only updates when the slider stops moving. </p>
  
  <p><strong>ui.R</strong></p>
  
  <pre><code>library(shiny)
  
  # Define UI for application that draws a histogram
  shinyUI(fluidPage(
  
    # Application title
    titlePanel("Hello Shiny!"),
  
    # Sidebar with a slider input for the number of bins
    sidebarLayout(
      sidebarPanel(
        sliderInput("bins",
                    "Number of bins:",
                    min = 1,
                    max = 50,
                    value = 30)
      ),
  
      # Show a plot of the generated distribution
      mainPanel(
        plotOutput("distPlot")
      )
    )
  ))
  </code></pre>
  
  <p><strong>server.R</strong></p>
  
  <pre><code>library(shiny)
  
  # Define server logic required to draw a histogram
  shinyServer(function(input, output) {
  
    # Expression that generates a histogram. The expression is
    # wrapped in a call to renderPlot to indicate that:
    #
    #  1) It is "reactive" and therefore should re-execute automatically
    #     when inputs change
    #  2) Its output type is a plot
  
    output$distPlot &lt;- renderPlot({
      x    &lt;- faithful[, 2]  # Old Faithful Geyser data
      bins &lt;- seq(min(x), max(x), length.out = input$bins + 1)
  
      # draw the histogram with the specified number of bins
      hist(x, breaks = bins, col = 'darkgray', border = 'white')
    })
  })
  </code></pre>
  
  <p>What I have tried:</p>
  
  <pre><code>#server.R
      library(shiny)
  
      shinyServer(function(input,output) {
                      x&lt;-faithful[,2]
                      bins &lt;- reactive({
                              seq(min(x),max(x),length.out=input$bins+1)
                      })
  
                      output$distPlot &lt;- renderPlot({
                      hist(x,breaks=bins(),col='darkgray',border='white')})
      })
  </code></pre>
  
  <p>Is there a way to make it react faster/real-time? </p>