title: Virtual environment in R?
body: <p>I've found several posts about best practice, reproducibility and workflow in R, for example:</p>
  
  <ul>
  <li><a href="https://stats.stackexchange.com/questions/4466/how-to-increase-longer-term-reproducibility-of-research-particularly-using-r-an">How to increase longer term reproducibility of research (particularly using R and Sweave)</a></li>
  <li><a href="https://stats.stackexchange.com/questions/1980/complete-substantive-examples-of-reproducible-research-using-r">Complete substantive examples of reproducible research using R</a></li>
  </ul>
  
  <p>One of the major preoccupations is ensuring portability of code, in the sense that moving it to a new machine (possibly running a different OS) is relatively straightforward and gives the same results.</p>
  
  <p>Coming from a Python background, I'm used to the concept of a virtual environment.  When coupled with a simple list of required packages, this goes some way to ensuring that the installed packages and libraries are available on any machine without too much fuss.  Sure, it's no guarantee - different OSes have their own foibles and peculiarities - but it gets you 95% of the way there.</p>
  
  <p>Does such a thing exist within R?  Even if it's not as sophisticated.  For example simply maintaining a plain text list of required packages and a script that will install any that are missing?</p>
  
  <p>I'm about to start using R in earnest for the first time, probably in conjunction with Sweave, and would ideally like to start in the best way possible!  Thanks for your thoughts.</p>