title: Where does R store temporary files
body: <p>I am running some basic data manipulation on a Macbook Air (4GB Memory, 120GB HD with 8GB available). My input file is about 40 MB, and I don't write anything to the disk until end of the process. However, in the middle of my process, my Mac says there's no memory to run. I checked hard drive and found there's about 500MB left.
  So here are my questions:</p>
  
  <ol>
  <li>How is it possible that R filled up my disk so quickly? My understanding is that R store everything in memory (unless I explicitly write something out to disk). </li>
  <li>If R does write temporary files on the disk, how can I find these files to delete them?</li>
  </ol>
  
  <p>Thanks a lot.</p>
  
  <p>Update 1: error message I got: </p>
  
  <pre><code>Force Quit Applications: Your Mac OS X startup disk has no more space available for 
  application memory
  </code></pre>
  
  <p>Update 2: I checked tempdir() and it shows "var/folders/k_xxxxxxx/T//Rtmpdp9GCo". But I can't locate this director from my Finder</p>
  
  <p>Update 3: After unlink(tempdir(),recursive=TRUE) in R and restarting my computer, I got my disk space back. I still would like to know if R write on my hard drive to avoid similar situations in the future.</p>
  
  <p>Update 4: My main object is about 1GB. I use Activity Monitor to track process, and while Memory usage is about 2GB, Disk activity is extremely high: Data read: 14GB, data write, 44GB. I have no idea what R is writing.</p>