title: Can I cache data loading in R?
body: <p>I'm working on a <code>R</code> script which has to load data (obviously). The data loading takes a lot of effort (500MB) and I wonder if I can avoid having to go through the loading step every time I rerun the script, which I do a lot during the development.</p>
  
  <p>I appreciate that I could do the whole thing in the interactive <code>R</code> session, but developing multi-line functions is just so much less convenient on the <code>R</code> prompt.</p>
  
  <p>Example:</p>
  
  <pre><code>#!/usr/bin/Rscript
  d &lt;- read.csv("large.csv", header=T) # 500 MB ~ 15 seconds
  head(d)
  </code></pre>
  
  <p>How, if possible, can I modify the script, such that on subsequent executions, <code>d</code> is already available? Is there something like a <code>cache=T</code> statement as in <code>R</code> markdown code chunks?</p>