title: How to install dependencies when using "R CMD INSTALL" to install R packages?
body: <p>I'm developing my first R package (using R 2.13, Ubuntu 10.10).  Let's call it <em>foo</em> and let's say that the code in the R/ directory begins with the line <em>library(bar)</em>, where <em>bar</em> is an existing package, in CRAN, on which <em>foo</em> depends. My DESCRIPTION file contains the line:</p>
  
  <pre><code>Depends: bar
  </code></pre>
  
  <p>When package <em>foo</em> is ready for testing, I install it locally using:</p>
  
  <pre><code>R CMD INSTALL foo_1.0.tar.gz
  </code></pre>
  
  <p>However, if <em>bar</em> is not installed, I see:</p>
  
  <pre><code>ERROR: dependency ‘bar’ is not available for package ‘foo’
  </code></pre>
  
  <p>Obviously, if my <em>foo</em> were installed from CRAN using install.packages(), <em>bar</em> would be installed at the same time.  So my question is: how can I ensure that CRAN package <em>bar</em> is installed, if required, when I install my package <em>foo</em> using R CMD INSTALL?  Is this a job for a configuration script?</p>