title: Go to next iteration of lapply() if error in r
body: <p>I'm using RSelenium and lapply() to scrape a fairly complex set of pages. I occasionally run into problems with the page not loading as expected and thus the code failing.</p>
  <p>It happens so rarely that rather than try and deal with every possible error, I would just like to skip the current iteration and go on to the next. It looks like tryCatch() is what I'm looking for, but I'm not sure where to put it in the code.</p>
  <p>I know this is not complete but I hope this is enough to go on as it looks like tryCatch() is wrapped around lapply() or with the return() statement. Thanks in advance.</p>
  <pre><code>team_id &lt;- c(1:10)
  df_list &lt;- lapply (1:length(team_id), function(x) {
          # complex navigation and scraping of multiple sub tables
          # to create a final teamtable
          &lt;code&gt;
          return(teamtable)
  })
  df &lt;- data.table::rbindlist(df_list)
  
  </code></pre>