title: Princomp error in R : covariance matrix is not non-negative definite
body: <p>I have this script which does a simple PCA analysis on number of variables and at the end attaches two coordinates and two other columns(presence, NZ_Field) to the output file. I have done this many times before but now its giving me this error:</p>
  
  <p>I understand that it means there are negative eigenvalues. I looked at similar posts which suggest to use na.omit but it didn't work. 
  I have uploaded the "biodata.Rdata" file here:</p>
  
  <p>covariance matrix is not non-negative definite</p>
  
  <p><a href="https://www.dropbox.com/s/1ex2z72lilxe16l/biodata.rdata?dl=0" rel="nofollow">https://www.dropbox.com/s/1ex2z72lilxe16l/biodata.rdata?dl=0</a></p>
  
  <p>I am pretty sure it is not because of missing values in data because I have used the same data with different "presence" and "NZ_Field" column.</p>
  
  <p>Any help is highly appreciated. </p>
  
  <pre><code>load("biodata.rdata")
  
  #save data separately
  coords=biodata[,1:2]
  biovars=biodata[,3:21]
  presence=biodata[,22]
  NZ_Field=biodata[,23]
  
  #Do PCA
  bpc=princomp(biovars ,cor=TRUE)
  
  #re-attach data with auxiliary data..coordinates, presence and NZ location data
  PCresults=cbind(coords, bpc$scores[,1:3], presence, NZ_Field)
  write.table(PCresults,file= "hlb_pca_all.txt", sep= ",",row.names=FALSE)
  </code></pre>