title: Where does RStudio store the temporary R script files before saved?
body: <p>I've just had RStudio crash on me unexpectedly, and on re-starting, contrary to what I've come to expect, the R script I had been tinkering around with was nowhere to be found.</p>
  
  <p>I've managed to track down the Rhistory file so I'll be able to piece together all the commands, which is reassuring.</p>
  
  <p>However, I <em>am</em> curious if there's somewhere I might try looking to find the temporary unsaved file on the off chance that might be cached somewhere (after all, it is <em>usually</em> cached somewhere that RStudio apparently knows to look). Is there a particular file extension/format I should be searching for?</p>
  
  <p>Currently running R 3.3.1 through RStudio 0.99.903 on Linux Mint 17.3 (over Ubuntu 14.04.3 LTS).</p>
  
  <hr>
  
  <p>I've tried running <code>grep</code> on the command line to find some of the more recently updated lines of code; I may be out of luck. I found two files:</p>
  
  <pre><code>~/.rstudio-desktop/history_database
  </code></pre>
  
  <p>Which appears to basically be a more centralized .Rhistory for RStudio</p>
  
  <p>and</p>
  
  <pre><code>~/.rstudio-desktop/sdb/s-9CD2C698/D7986B2A
  </code></pre>
  
  <p>This looks JSON-like and also appears to basically be an Rhistory. Please correct me if I'm wrong.</p>