title: Predict function returns more values than those required
body: <p>My dataset consists of 60 observations in three variables, <code>x1</code> and <code>x2</code> which are my predictors, and <code>y</code> which is my response. The problem is that the last 20 observations in <code>y</code> are missing so I fitted a linear regression model, which I called <code>fit</code>, onto the first 40 observations and now I have been trying to use the <code>predict</code> function to generate the missing values.</p>
  
  <p>The code for the regression I used is</p>
  
  <blockquote>
    <p>fit&lt;-lm(y1a~x1a+x2a)</p>
  </blockquote>
  
  <p>where y1a,x1a and x2a refer to the first 40 observations.</p>
  
  <p>The code I have been using to fill in the remaining values is:</p>
  
  <pre><code>x &lt;- data.frame(data$x1[41:60], data$x2[41:60])
  
  predict(fit,x,interval="prediction",level=0.95)
  </code></pre>
  
  <p>But now the problem is that I get 40 new values for <code>y</code> instead of the required 20, along with the warning message:</p>
  
  <blockquote>
    <p>'newdata' had 20 rows but variables found have 40 rows</p>
  </blockquote>
  
  <p>Could you please tell me what I am doing wrong?</p>