title: How to prevent R from stopping when it can't find the file to open?
body: <p>My R code is trying to open a RDS file in a for loop as follows:</p>
  <pre><code>for(i in 1:run_loops){
      source(&quot;./scripts/load_data.R&quot;)
      model &lt;- readRDS(file=paste(model_directory,&quot;/&quot;,modelname,&quot;.Rds&quot;, sep=&quot;&quot;)) #STOPS-HERE!!!
      source(&quot;./scripts/prediction.R&quot;)
    }
  </code></pre>
  <p>R stops when there is no model file.<br />
  How do I get it to move to the next iteration instead of stopping?</p>
  <p>P.S. modelname variable changes each time load_data.R is sourced.</p>