title: Using tryCatch and rvest to deal with 404 and other crawling errors
body: <p>When retrieving the h1 title using <code>rvest</code>, I sometimes run into 404 pages. This stop the process and returns this error.</p>
  
  <blockquote>
    <p>Error in open.connection(x, "rb") : HTTP error 404. </p>
  </blockquote>
  
  <p>See the example below</p>
  
  <pre><code>Data&lt;-data.frame(Pages=c(
  "http://boingboing.net/2016/06/16/spam-king-sanford-wallace.html",
  "http://boingboing.net/2016/06/16/omg-the-japanese-trump-commer.html",
  "http://boingboing.net/2016/06/16/omar-mateen-posted-to-facebook.html",
  "http://boingboing.net/2016/06/16/omar-mateen-posted-to-facdddebook.html"))
  </code></pre>
  
  <p>Code used to retrieve h1</p>
  
  <pre><code>library (rvest)
  sapply(Data$Pages, function(url){
   url %&gt;%
   as.character() %&gt;% 
   read_html() %&gt;% 
   html_nodes('h1') %&gt;% 
   html_text()
   })
  </code></pre>
  
  <p>Is there a way to include an argument to ignore errors and continue the process ?</p>