title: Changing temporary directory in R
body: <p>I'm using a Windows virtual machine and I have both R and RStudio installed on it and I'm trying to change the directory where R writes the temporary files. </p>
  
  <p>When I start R, I try changing the temporary directory and then close R. When I restart R and try <code>tempdir()</code> it still shows the old directory, as if nothing has happened. However, if after attempting to change the temporary directory in R I start RStudio instead of restarting R, when I try <code>tempdir()</code> in RStudio it shows the new/updated directory I set in R. How is this possible? What is happening? Why does only RStudio respond to my changing of the temporary directory but not R, even though that's where I'm changing the directory?</p>