title: What cases error in predict for glm in R?
body: <p>I have run a negative binomial model. I am trying to get a preduction using my final model:  </p>
  
  <pre><code>&gt; # prediction and GOF
  &gt;     str(epilepsy_reduced)
  Classes ‘tbl_df’, ‘tbl’ and 'data.frame':   58 obs. of  4 variables:
   $ treatment   : num  0 0 0 0 0 0 0 0 0 0 ...
   $ age         : int  31 30 25 36 22 29 31 42 37 28 ...
   $ seizure.rate: int  3 3 5 4 21 7 2 12 5 0 ...
   $ ID          : int  1 2 3 4 5 6 7 8 9 10 ...
  &gt;     
  &gt;     placebo_patient &lt;- data.frame(treatment=as.numeric(0), age=as.integer(30))
  &gt;     progabide_patient &lt;- data.frame(treatment=as.numeric(1), age=as.integer(30))
  &gt;     
  &gt;     str(placebo_patient)
  'data.frame':   1 obs. of  2 variables:
   $ treatment: num 0
   $ age      : int 30
  &gt;     str(progabide_patient)
  'data.frame':   1 obs. of  2 variables:
   $ treatment: num 1
   $ age      : int 30
  &gt;     
  &gt;     age30 &lt;- predict(epilepsy_reduced, newdata=placebo_patient, type="response")
  Error in UseMethod("predict") : 
    no applicable method for 'predict' applied to an object of class "c('tbl_df', 'tbl', 'data.frame')"
  &gt;     age30
  Error: object 'age30' not found
  </code></pre>
  
  <p><strong>What is causing this error ?</strong></p>