title: R kmeans NAs in foreign function call (arg 13) error
body: <p>I have numeric data in a vector and I'm trying to run kmeans on it. The following gives an error</p>
  
  <pre><code>&gt; kmeans( mydata, centers = 2 ) # trying centers 2 to 20 but failing at 2
  Error in do_one(nmeth) : NAs in foreign function call (arg 13)
  In addition: Warning message:
  In do_one(nmeth) : NAs introduced by coercion
  
  &gt; str(mydata)
   num [1:44990687] 3.44e-06 3.44e-06 3.44e-06 3.44e-06 4.35e-05 ...
  &gt; is.numeric(mydata)
  [1] TRUE
  </code></pre>
  
  <p>My code works for the datasets that are smaller than this one, so I suspect it may have something to do with the size of the data. Any ideas on how to fix the error? Thanks in advance.</p>
  
  <p>Update:
  I've tried the following:</p>
  
  <pre><code>&gt; x &lt;- length(mydata)
  &gt; kmeans( mydata[1:(x/2)], centers = 2 )
  &gt; kmeans( mydata[(x/2):x], centers = 2 )
  </code></pre>
  
  <p>Both calls to kmeans finish with no errors. So it does look like it has something to do with the size of the data and not the format/types. If that's the case, what should I do to be able to handle it?
  Thanks again.</p>