title: Previous input in Shiny
body: <p>How to retain previous input in Shiny?</p>
  
  <p>I want to show how estimates change according to user input.</p>
  
  <p>E.g., If user changes input and an estimate is up, then in some panel I want to print that estimates is up.</p>
  
  <p>To do so, I want to get sequence of user input such as </p>
  
  <pre><code>&gt; c(2,4,5,6)
  [1] 2 4 5 6
  </code></pre>
  
  <p>where <code>2,4,5,6</code> is  previous inputs obtained by <code>sliderInput</code>.
  That is, first, user chose <code>2</code>, second chosen number is<code>4</code>,..and so on.</p>
  
  <hr>
  
  <p><strong>Edit</strong></p>
  
  <p>The following is the ansewer of @GyD.</p>
  
  <pre><code>    library(shiny)
      # Define UI for application that draws a histogram
      ui &lt;- fluidPage(
  
          # Application title
          titlePanel("Old Faithful Geyser Data"),
  
          # Sidebar with a slider input for number of bins 
          sidebarLayout(
              sidebarPanel(
                  sliderInput("bins",
                              "Number of bins:",
                              min = 1,
                              max = 50,
                              value = 30)
              ),
  
              # Show a plot of the generated distribution
              mainPanel(
                 verbatimTextOutput("print")
              )
          )
      )
  
      # print history of user input
      server &lt;- function(input, output) {
  
          rv &lt;- reactiveValues(prev_bins = NULL)
          observeEvent(input$bins, {
  # If event occurs, then run the following append function
              rv$prev_bins &lt;- c(rv$prev_bins, input$bins)
          })
  
          # Output
          output$print &lt;- renderPrint({
              paste(rv$prev_bins, collapse = ",")
          })
  
          # output$print &lt;- renderPrint({
          #    
          #     paste(s, input$bins,sep = ",")
          # })
      }
  
      # Run the application 
      shinyApp(ui = ui, server = server)
  </code></pre>