title: CCA Analysis: Error in weighted.mean.default(newX[, i], ...) : 'x' and 'w' must have the same length
body: <p>I'm very new to R and this might be a very silly question to ask but I'm quite stuck right now.</p>
  
  <p>I'm currently trying to do a Canonical Correspondence Analysis on my data to see which environmental factors have more weight on community distribution. I'm using the vegan package. My data consists of a table for the environmental factors (dataset EFamoA) and another for an abundance matrix (dataset AmoA). I have 41 soils, with 39 environmental factors and 334 species. 
  After cleaning my data of any variables which are not numerical, I try to perform the cca analysis using the formula notation:</p>
  
  <pre><code>CCA.amoA &lt;- cca (AmoA ~ EFamoA$PH + EFamoA$LOI, data = EFamoA, 
  scale = TRUE, na.action = na.omit)
  </code></pre>
  
  <p>But then I get this error:</p>
  
  <pre><code>Error in weighted.mean.default(newX[, i], ...) : 
  'x' and 'w' must have the same length
  </code></pre>
  
  <p>I don't really know where to go from here and haven't found much regarding this problem anywhere (which leads me to think that it must be some sort of very basic mistake I'm doing). My environmental factor data is not standardized as I red in the cca help file that the algorithm does it but maybe I should standardize it before? (I've also red that scale = TRUE is only for species). Should I convert the data into matrices?</p>
  
  <p>I hope I made my point clear enough as I've been struggling with this for a while now.</p>
  
  <p>Edit: My environmental data has NA values</p>