title: Installing "rgl" package in R, Mac OSX El Captian
body: <p>I'm new to programming in R so I apologise in advance if I seem naive. I want to be able to do some principal components analysis on my data in 3D. I read that the "pca3d" function is good for this, but I need to download the "rgl" library. When I use install.packages it asks:</p>
  
  <pre><code>install.packages("rgl")
  
    There is a binary version available but the source version is later:
     binary    source needs_compilation
  rgl 0.95.1201 0.95.1367              TRUE
  
  Do you want to install from sources the package which needs compilation?
  y/n: n
  </code></pre>
  
  <p>I have tried installing it as both binary and source, but nothing seems to work. If I try loading the binary version, I get this error:</p>
  
  <pre><code>Error : .onLoad failed in loadNamespace() for 'rgl', details:
    call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl/libs/rgl.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl/libs/rgl.so, 6): Library not loaded: /opt/X11/lib/libGLU.1.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl/libs/rgl.so
    Reason: image not found
  Error: package or namespace load failed for ‘rgl’
  </code></pre>
  
  <p>If I say "yes" to installing from source, I get the following error:</p>
  
  <pre><code>configure: error: X11 not found but required, configure aborted.
  ERROR: configuration failed for package ‘rgl’
  * removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl’
  * restoring previous ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl’
  Warning in install.packages :
   installation of package ‘rgl’ had non-zero exit status
  </code></pre>
  
  <p>I've been searching for hours on how to make this work so if someone could run through how I should go about installing the rgl package then I would be extremely grateful!</p>
  
  <p>Thanks, 
  Claire</p>