title: Is it possible to stop executing of R code inside shiny (without stopping the shiny process)?
body: <p>Let's say I have a shiny app that has a function that can take a long time to run.  Is it possible to have a "stop" button that tells R to stop the long-running call, without having to stop the app?</p>
  
  <p>Example of what I mean:</p>
  
  <pre><code>analyze &lt;- function() {
    lapply(1:5, function(x) { cat(x); Sys.sleep(1) })
  }
  
  runApp(shinyApp(
    ui = fluidPage(
      actionButton("analyze", "Analyze", class = "btn-primary"),
      actionButton("stop", "Stop")
    ),
    server = function(input, output, session) {
      observeEvent(input$analyze, {
        analyze()
      })
      observeEvent(input$stop, {
        # stop the slow analyze() function
      })
    }
  ))
  </code></pre>
  
  <p>edit: <a href="https://groups.google.com/forum/#!topic/shiny-discuss/j9-NeG9v5ds" rel="noreferrer">x-post from shiny-discuss</a></p>