title: How to do offline install of R libraries with dependencies from Linux command line?
body: <p>I need to script the install of some R libraries on an offline system. I do possess the source library files I need as I did the <code>install.packages()</code> from within R on a test system that was online, I saved the downloaded source tar.gz files which included all the dependencies of that library as well. </p>
  
  <p>On the test system that's offline, normally I'd install an R library on the Linux command Linux command line like this, ex:</p>
  
  <pre><code>R CMD INSTALL ggplot2_0.9.3.1.tar.gz
  </code></pre>
  
  <p>But that only seems to work with packages that have no unmet dependencies. I was hoping by putting all the dependencies in the same folder, it would also install those dependency libraries it needed automatically like <code>install.packages()</code> does but this is not the case as it complained:</p>
  
  <pre><code>[root@new-host-15 extra]# R CMD INSTALL ggplot2_0.9.3.1.tar.gz
  * installing to library ‘/usr/lib64/R/library’
  ERROR: dependencies ‘plyr’, ‘digest’, ‘gtable’, ‘reshape2’, ‘scales’, ‘proto’ are not available for package ‘ggplot2’
  * removing ‘/usr/lib64/R/library/ggplot2’
  </code></pre>
  
  <p>My initial thoughts were I would need to install the other dependencies in order with additional <code>R CMD INSTALL</code> commands but that's a lot of extra commands I would like to avoid if possible. Is there an automatic way to install ggplot2 for example and have all the dependencies which I do have the files for in the same folder also installed automatically without having to specify them individually? </p>