title: Shiny: I don't know how stop one process started by a button by pressing another button
body: <p>I need some help with my Shiny app. I'll try to simplify my question. My problem is that a I'm developing an application that makes a report when a button is pressed. This report takes between 10 and 15 minutes. I would have another button (a 'Stop' button) that stops the previous process but doesn't stop my application. For ilustrate that, I'll show a simply code I can take as reference for resolve my app. I would like counting started by pressing at 'count' button, stops if I press 'stop' button.</p>
  
  <p>ui.R code:</p>
  
  <pre><code>shinyUI(
     fluidPage(
     actionButton("count","Start count"),
     actionButton("stop","Stop count")
     )
  )
  </code></pre>
  
  <p>server.R code:</p>
  
  <pre><code>shinyServer(function(input, output, session) {
  
     observeEvent(input$count, {
  
        observeEvent(input$stop, {
           # Code for stop counting
        })
  
        i &lt;- 1
        for (i in i:10000) {
           print(paste("Number: ",i))
        }
     })
  })
  </code></pre>
  
  <p>Thanks a lot friends!</p>