title: PCA with prcomp gives unexpected results
body: <p>I'm trying to understand what prcomp does in R, as it uses SVD under the hood.  Here's a simple example using a unit matrix:</p>
  
  <pre><code>xdim &lt;- 4
  arr &lt;- array(0, dim=c(xdim,xdim))
  for(v in 1:xdim) { arr[v,v]=1.0 }
  pcaa &lt;- prcomp(arr)
  </code></pre>
  
  <p>pcaa$rotation should contain a unit matrix but doesn't.  If I use</p>
  
  <pre><code>pcaa &lt;- prcomp(arr, center=FALSE)
  </code></pre>
  
  <p>then it does.  Shouldn't the eigenvectors be simple to calculate?  Why does centering the data throw it off?  </p>