title: Mclust : NAs in foreign function call (arg 13)
body: <p>While trying to determine the optimal number of clusters for a kmeans, I tried to use the package <code>mclust</code> with the following code :</p>
  
  <pre><code>d_clust &lt;- Mclust(df, 
                    G=1:10,      
                    mclust.options("emModelNames"))
  d_clust$BIC
  </code></pre>
  
  <p>df is a data frame of 132656 obs. of 19 variables, the data is scaled, and there is no missing values (no <code>NA/NaN/Inf</code> values I checked with <code>is.na</code> and <code>is.finite</code>). Also, my variables are all in numeric format thanks to <code>as.numeric</code></p>
  
  <p>However after using the code, the screen displays "fitting" with a loading bar, goes up to 11%, and then after a moment I get the error message :</p>
  
  <blockquote>
    <p>NAs in foreign function call (arg 13)</p>
  </blockquote>
  
  <p>Does anyone know why I have this type of error ?</p>
  
  <h2>EDIT</h2>
  
  <p>Output of <code>str(df)</code> (I modified the variable name because of confidential issues)</p>
  
  <pre><code>'data.frame':   132656 obs. of  19 variables:
  
   $ X1: num  0.5 1 1 1 0.5 1 1 1 1 1 ...
   $ X2: num  0.714 0.286 1 0.857 0.286 ...
   $ X3: num  0.667 1 0.667 0.667 0.667 ...
   $ X4: num  0.714 0.429 1 0.714 0.429 ...
   $ X5: num  0.667 0.333 1 0.667 0.333 ...
   $ X6: num  0.5 0.25 1 0.5 0.25 0.25 0 0.5 0.5 0.25 ...
   $ X7: num  0.667 0.667 0.667 0.667 0.667 ...
   $ X8: num  0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ...
   $ X9: num  0.667 0 0.667 0.333 0 ...
   $ X10: num  1 0.833 1 1 1 ...
   $ X11: num  1 0.75 1 1 1 1 1 1 1 1 ...
   $ X12: num  1 1 1 0.8 1 1 1 1 1 1 ...
   $ X13: num  0.5 0.75 0.75 0.5 0.75 0.25 0.75 0.5 0.5 0.5 ...
   $ X14: num  0.75 0.75 0.75 1 0.75 0.75 0.75 1 0.75 0.75 ...
   $ X15: num  1 0 0.5 1 1 1 0.75 1 0.5 1 ...
   $ X16: num  1 0.333 0.667 0.833 0.833 ...
   $ X17: num  1 1 1 1 1 1 1 1 1 1 ...
   $ X18: num  0.00157 0.000438 0.001059 0.000879 0.004919 ...
   $ X19: num  0.5 0.125 1 0.625 0.125 0.125 0.125 1 0.5 0.25 ...
  </code></pre>