title: Naive bayes in R
body: <p>I am getting an error while running naive bayes classifier in R. I am using the following code-</p>
  
  <pre><code>mod1 &lt;- naiveBayes(factor(X20) ~ factor(X1) + factor(X2) +factor(X3) +factor(X4)+factor(X5)+factor(X6)+factor(X7)
                 +factor(X8)+factor(X9)
                 +factor(X10)+factor(X11)+ factor(X12)+factor(X13)+factor(X14)
                 +factor(X15)
                 +factor(X16)+factor(X17)
                 +factor(X18)+factor(X19),data=intent.test)
  
  res1 &lt;- predict(mod1)$posterior
  </code></pre>
  
  <p>First part of this code runs fine. But when it try to predict the posterior probability it throws following error-</p>
  
  <pre><code>**Error in as.data.frame(newdata) : 
  argument "newdata" is missing, with no default**
  </code></pre>
  
  <p>I tried running something like    </p>
  
  <pre><code>res1 &lt;- predict(mod1,new_data=intent.test)$posterior
  </code></pre>
  
  <p>but this also gives the same error.</p>