title: clustering with NA values in R
body: <p>I was surprised to find out that <code>clara</code> from <code>library(cluster)</code> allows NAs. But function documentation says nothing about how it handles these values.</p>
  
  <p>So my questions are:</p>
  
  <ol>
  <li>How <code>clara</code> handles NAs?</li>
  <li>Can this be somehow used for <code>kmeans</code> (Nas not allowed)?</li>
  </ol>
  
  <p><strong>[Update]</strong> So I did found lines of code in <code>clara</code> function:</p>
  
  <pre><code>inax &lt;- is.na(x)
  valmisdat &lt;- 1.1 * max(abs(range(x, na.rm = TRUE)))
  x[inax] &lt;- valmisdat
  </code></pre>
  
  <p>which do missing value replacement by <code>valmisdat</code>. Not sure I understand the reason to use such formula. Any ideas? Would it be more "natural" to treat NAs by each column separately, maybe replacing with mean/median?</p>