title: Installing packages in R: installing "mediation" fails despite dependencies being up-to-date
body: <p>I am trying to install the <a href="http://cran.r-project.org/web/packages/mediation/index.html" rel="nofollow">mediation</a> package. However, this fails due to lacking dependencies:</p>
  
  <pre><code>&gt; install.packages("mediation")
  Installing package into ‘/home/simoncolumbus/R/i686-pc-linux-gnu-library/3.0’
  (as ‘lib’ is unspecified)
  trying URL 'http://cran.rstudio.com/src/contrib/mediation_4.4.4.tar.gz'
  Content type 'application/x-gzip' length 1463736 bytes (1.4 Mb)
  opened URL
  ==================================================
  downloaded 1.4 Mb
  
  * installing *source* package ‘mediation’ ...
  ** package ‘mediation’ successfully unpacked and MD5 sums checked
  ** R
  ** data
  *** moving datasets to lazyload DB
  ** demo
  ** inst
  ** preparing package for lazy loading
  Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
    namespace ‘lattice’ 0.20-24 is already loaded, but &gt;= 0.20.27 is required
  Error : package ‘sandwich’ could not be loaded
  ERROR: lazy loading failed for package ‘mediation’
  * removing ‘/home/simoncolumbus/R/i686-pc-linux-gnu-library/3.0/mediation’
  Warning in install.packages :
    installation of package ‘mediation’ had non-zero exit status
  
  The downloaded source packages are in
      ‘/tmp/RtmpWpmJqS/downloaded_packages’
  </code></pre>
  
  <p>This is somewhat surprising, because both lattice and sandwich, as well as zoo (which calls lattice) are up to date:</p>
  
  <pre><code>&gt; installed.packages()
  lattice      "lattice"      "/home/simoncolumbus/R/i686-pc-linux-gnu-library/3.0" "0.20-31"   "recommended"
  sandwich     "sandwich"     "/home/simoncolumbus/R/i686-pc-linux-gnu-library/3.0" "2.3-3"     NA
  zoo          "zoo"          "/home/simoncolumbus/R/i686-pc-linux-gnu-library/3.0" "1.7-12"    NA
  </code></pre>
  
  <p>I've tried unloading the packages, updating them, installing them via the package manager - nothing seems to have an impact, though. Any suggestions?</p>
  
  <p>Edit: Fixed the problem by updating to the latest available version of R; must be some incompatibility with the old version I was running that caused this.</p>