title: R continue loop on error
body: <h1>apparently try and trycatch do not work for this problem! Any alternative solutions?</h1>
  <p>i'm trying to make the following example code work without actually changing any code</p>
  <pre><code>result = 0
  for(i in 1:10){
    result = result + i
    log(&quot;a&quot;) #I do not care about this error
    result = result + i
  }
  </code></pre>
  <p>This should give result = 110</p>
  <p>If i actually do it manually by copying the part inside the loop and increasing the counter it works perfectly:</p>
  <pre><code>result = 0
  
  #iteration 1
  i = 1
  result = result + i
  log(&quot;a&quot;)
  result = result + i
  
  #iteration 2
  i = i+1
  result = result + i
  log(&quot;a&quot;)
  result = result + i
  
  #iteration 3
  i = i+1
  result = result + i
  log(&quot;a&quot;)
  result = result + i
  
  #etc.
  </code></pre>
  <p>However my real code has about 1000 lines and needs to loop a few hundred times.</p>
  <p>So i'd like to have some option</p>
  <pre><code>options(on.error.just.continue.the.next.line) = TRUE
  </code></pre>
  <p>I've read about try/tryCatch but I don't understand it correctly I think</p>