title: Installing R package (spdep) in OS X from source --- compilation error
body: <p>I am trying to install a R package (<code>spdep</code>) on a OS X 10.9 Mavericks, with R 3.0.1 (<code>sessionInfo</code> at the bottom). The package was downloaded from <a href="http://cran.r-project.org/web/packages/spdep/index.html" rel="nofollow">http://cran.r-project.org/web/packages/spdep/index.html</a> (source file <code>spdep_0.5-71.tar.gz</code>), and I tried to install it via terminal using <code>R CMD INSTALL</code>.</p>
  
  <p>The problem is that terminal yields this error:</p>
  
  <pre><code>ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
  ld: library not found for -lgfortran
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  make: *** [spdep.so] Error 1
  ERROR: compilation failed for package ‘spdep’
  * removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/spdep’
  </code></pre>
  
  <p>I tried to re-install Xcode and the command line tools, which I already had. And I also installed <code>gfortran-4.8.2-darwin13.tar.bz2</code> doing <code>sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2
  </code>in the terminal. But it still gives me the same error. </p>
  
  <p>Any solution?</p>
  
  <p>Thanks!</p>
  
  <pre><code>&gt; sessionInfo()
  R version 3.1.0 (2014-04-10)
  Platform: x86_64-apple-darwin13.1.0 (64-bit)
  </code></pre>