title: R - Looping through json files using jsonlite
body: <p>I am writing a script that loops through about 30,000 json files, reading them using jsonlite. However, I always encounter a fatal error like the one below about 5,000 files into my loop. I've written a similar script in python without any issue, but I cannot figure out why it won't work in R. I installed R on another machine and got the same error. Both machines are Windows 7. I am confident that this has nothing to do with the content of the json files, and the point at which the error is thrown changes every time, but it's always around 5000.</p>
  
  <p>The loop I've been using for testing looks like this</p>
  
  <pre><code>t &lt;- 0
  
  for (filename in filenamelist){
     t &lt;- t + 1
     print(t)
     json_data = fromJSON(filename )
  }
  </code></pre>
  
  <p>The error looks like this: </p>
  
  <pre><code>Error in parseJSON(txt):
     parse error: client cancelled parse via callback return value
  
  Error during wrapup: lazy-load database 'C:/PROGRA~1/R/R-31~1.2/library/base/R/base.rbd' is corrupt
  </code></pre>