title: Naive Bayes with R
body: <p>I'm trying to use naive bayes in R for classification.</p>
  
  <p>This is my data:</p>
  
  <pre>
     Anon_Student_Id               Problem_Hierarchy Problem_Name Problem_View Number_Of_Steps Sum_Of_Steps_Duration Sum_Of_Incorrects Sum_Of_Hints CFA_ratio result
  1      02ZjVTxC34 Unit CTA1_01, Section CTA1_01-1   LDEMO_WKST            1              12                   643                 0            0 1.0000000      1
  2      02ZjVTxC34 Unit CTA1_01, Section CTA1_01-2       BH1T08            1              12                   199                 2            0 0.8333333      0
  3      02ZjVTxC34 Unit CTA1_01, Section CTA1_01-2       BH1T15            1              11                   197                 1            0 0.9090909      0
  4      02ZjVTxC34 Unit CTA1_01, Section CTA1_01-2      BH1T17B            1              11                   550                 4            0 0.8181818      0
  5      02ZjVTxC34 Unit CTA1_01, Section CTA1_01-2      BH1T22C            1               8                   555                 2            0 0.8750000      0
  6      02ZjVTxC34 Unit CTA1_01, Section CTA1_01-2       BH1T24            1              10                   431                 5            0 0.7000000      0 
  </pre>
  
  <p>I need to predict the result column.
  I'm doing something like what's in the iris example:</p>
  
  <pre><code>classifier&lt;-naiveBayes(A[,1:9], A[,10]) &lt;br&gt;
  predict(classifier, A[,-10])
  </code></pre>
  
  <p>but I'm getting:</p>
  
  <pre><code>factor(0)
  Levels: 
  </code></pre>
  
  <p>Why?!</p>