How to automatically install all required packages?
<p>Right now, I resolve dependencies with the following method:</p>

<ol>
<li>Source the file.</li>
<li>If it complains about needing package X, install package X.</li>
<li>Go to 1.</li>
</ol>

<p>If there is a large number of required packages this can get tedious. Is there a single command that can determine every required package and then automatically install them all?</p>

<p>I have RStudio 0.98.1056 and R 3.3.1.</p>