title: R predict NAs are not allowed in subscripted assignments
body: <p>I would like to use the predict function. I have two sets of data frames (one for calibration, the second for validation). 
  Here are the two data sets :</p>
  
  <pre><code>head(df_calib)
  #      A   B   C   D       COND
  #1     0  11  11   9          A    
  #2     5   2   5  19          A    
  #3     4   3  10  14          A    
  #4    18  13   0   0          B    
  #5    22   9   0   0          C    
  #6     4   9   2  16          B    
  
  head(df_valid)
  #     A   B   C   D       COND    
  #1   14  16   1   0          A    
  #2   20   9   2   0          A    
  #3   16   6   9   0          A    
  #4   16   2  11   2          A    
  #5    4   8  14   5          C    
  #6    4   3  13  11          C    
  </code></pre>
  
  <p>In my program I first define the predict and then I </p>
  
  <pre><code>library(mda)
  discrim &lt;- fda(COND~ ., data=df_calib)
  pred &lt;- predict(discrim,df_valid)
  </code></pre>
  
  <p><code>discrim</code> seems to work fine (if I plot <code>discrim</code>) but when I calculate <code>pred</code>, I get this message :</p>
  
  <pre><code>pred &lt;- predict(discrim,df_valid)
  </code></pre>
  
  <blockquote>
    <p>Error in mindist[l] &lt;- ndist[l] : 
          NAs are not allowed in subscripted assignments</p>
  </blockquote>
  
  <p>Could you help me to solve that problem ?</p>
  
  <p><strong>Here some additional information about the data :</strong></p>
  
  <p><code>formula(discrim)</code> provides that:</p>
  
  <pre><code>COND ~ A + B + C + D
  attr(,"variables")
  #list(COND, A, B, C, D)
  attr(,"factors")
  #     A B C D
  #COND 0 0 0 0
  #A    1 0 0 0
  #B    0 1 0 0
  #C    0 0 1 0
  #D    0 0 0 1
  attr(,"term.labels")
  #[1] "A" "B" "C" "D"
  attr(,"order")
  #[1] 1 1 1 1
  attr(,"intercept")
  #[1] 1
  attr(,"response")
  #[1] 1
  attr(,"predvars")
  #list(COND, A, B, C, D)
  attr(,"dataClasses")
  # COND         A         B         C         D 
  #"character"   "numeric"   "numeric"   "numeric"   "numeric" 
  </code></pre>
  
  <p>Info about df_valid and df_calib:</p>
  
  <pre><code>str(df_valid)
  #'data.frame':  26 obs. of  5 variables:
  # $ A       : num  0 0 0 0 8 15 17 19 18 14 ...
  # $ B       : num  17 15 8 7 2 2 3 5 5 4 ...
  # $ C       : num  2 2 2 2 14 12 6 3 2 1 ...
  # $ D       : num  12 14 21 22 7 2 5 4 6 12 ...
  # $ COND: chr [1:26(1d)] "A" "A" "A" "A" ...
  
  str(df_calib)
  #'data.frame':  520 obs. of  5 variables:
  # $ A       : num  0 5 4 18 22 4 1 9 12 15 ...
  # $ B       : num  11 2 3 13 9 9 3 1 3 15 ...
  # $ C       : num  11 5 10 0 0 2 11 5 0 1 ...
  # $ D       : num  9 19 14 0 0 16 16 16 16 0 ...
  # $ COND: chr [1:520(1d)] "A" "A" "A" "B" ...
  </code></pre>