title: How to deal with missing value error - vegan::rda()
body: <p>I used <code>Vegan</code> <code>R</code> package to analyze my data. But I have some missing value in my data, so when I use function <code>rda</code>.
  The output is like this:</p>
  
  <pre><code>#RDA
  pca.rda &lt;- rda(pcan ~ ., data = all.env, scale = FALSE)
  </code></pre>
  
  <blockquote>
    <p>Error in na.fail.default(list(Plot = c(7L, 8L, 9L, 34L, 35L, 36L, 61L,  : 
      missing values in object</p>
  </blockquote>
  
  <p>Do anyone know how to do with these missing value?</p>
  
  <p>I have missing value only in two columns of data, see below</p>
  
  <pre><code>all.env$SM
  [1] 21.92 25.92 27.47 30.49 31.18 29.54 30.06    NA 24.17 27.52 30.29 24.25 28.61 34.57 33.63
  [16]    NA    NA    NA 23.52 23.52 28.69 29.41 32.68 30.29    NA    NA    NA 13.35 11.33 17.59
  [31] 26.39 27.44 24.47 21.09    NA 15.61 19.46 21.09 13.60 25.97 26.34    NA    NA    NA    NA
  [46] 17.64 16.01 16.31 22.05 23.46 22.39    NA    NA    NA 13.23 19.36 17.27 29.34 28.31 30.13
  [61] 20.48    NA 20.20 19.87 20.69 16.30 27.45 24.55    NA    NA    NA    NA 19.37 21.14 16.81
  [76] 24.13 26.09 25.79    NA    NA    NA
  
  all.env$ST
  [1] 19.40 19.70 19.69 20.86 19.95 20.22 21.04    NA 21.79 20.34 19.55 20.14 21.12 21.03 20.78
  [16]    NA    NA    NA 20.24 20.28 20.43 21.52 21.56 21.11    NA    NA    NA 17.63 18.11 18.97
  [31] 18.27 18.19 19.22 19.46    NA 20.16 18.93 18.81 19.50 19.70 19.99    NA    NA    NA    NA
  [46] 18.06 18.43 18.83 20.56 20.78 19.42    NA    NA    NA    NA 18.12    NA    NA 18.09    NA
  [61] 19.11    NA 19.90 18.78    NA 19.48 19.62    NA    NA    NA    NA    NA 17.91 18.18 18.61
  [76] 20.44 21.17 19.35    NA    NA    NA
  </code></pre>
  
  <h1>first I reclass some data into factor</h1>
  
  <pre><code>all.env$Site&lt;-as.factor(all.env$Site)    
  all.env$Type &lt;- as.factor(all.env$Type)    
  all.env$Slope&lt;- as.factor(all.env$Slope)    
  summary(all.env)
  </code></pre>
  
  <h1>do PCA</h1>
  
  <pre><code>pcan &lt;- rda(pcaall[7:72])    
  pcan
  </code></pre>
  
  <h1>RDA</h1>
  
  <pre><code>pca.rda &lt;- rda(pcan ~ .,data = all.env, scale=FALSE)
  </code></pre>
  
  <p>After this I got error message</p>
  
  <blockquote>
    <p>Error in na.fail.default(list(Plot = c(7L, 8L, 9L, 34L, 35L, 36L, 61L,  : 
      missing values in object</p>
  </blockquote>
  
  <p>I also tried to use Median value of these two column.</p>
  
  <pre><code>`all.env$SM[is.na(all.env$SM)] &lt;- median(all.env$SM, na.rm=TRUE)`
  `all.env$ST[is.na(all.env$ST)] &lt;- median(all.env$ST, na.rm=TRUE)`
  </code></pre>
  
  <h1>RDA</h1>
  
  <pre><code>`pca.rda &lt;- rda(pcan ~ .,data = all.env, scale=FALSE)`
  </code></pre>
  
  <p>Still, I got error message.</p>
  
  <p>Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric</p>