title: Reactive Loop in R Shiny
body: <p>I've been stuck on this problem for hours.  I tried to create a simpler version of my actual use case to see if I can debug the problem but still having trouble.</p>
  
  <p>My shiny app is below.  It takes an input from user, runs it through some calculations until it meets a threshold, then collects the value in a list.  It does this for several iterations (10 here in the example), then plots a histogram of these values.</p>
  
  <p>The specific error I'm getting says</p>
  
  <pre><code>Warning: Error in : evaluation nested too deeply: infinite recursion / options(expressions=)?
  </code></pre>
  
  <p>I think that my error is related to the way I'm using <code>x.new</code>, but I can't figure out how to code it differently.</p>
  
  <pre><code># install.packages('shiny')
  library(shiny)
  ui &lt;- fluidPage(
    headerPanel('Title Here'),
    sidebarPanel(
      numericInput('x.qty', 'Pick a number', 3, 1, 10)),
    mainPanel(plotOutput('valueplot'))
  )
  
  server &lt;- function(input, output, session) {
    results &lt;- reactive({
      x.list &lt;- list()
      for (i in 1:10){
        x.new &lt;- reactive({input$x.qty * sample(1:10, 1)})
        repeat{
          if (x.new() &gt; 20){
            x.list &lt;- c(x.list, x.new())
            results &lt;- x.list
            break
          } # end if loop
          x.new &lt;- reactive({x.new() * sample(1:10, 1)})
        } # end repeat
      } # end for loop
      results
    })
    output$valueplot &lt;- renderPlot({hist(as.numeric(results()))})
  }  
  
  shinyApp(ui = ui, server = server)
  </code></pre>