title: Classification with naiveBayes (e1071) does not work ($levels returns NULL)
body: <p>I use naiveBayes (e1071 <a href="http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification/Na%C3%AFve_Bayes" rel="noreferrer">http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification/Na%C3%AFve_Bayes</a>) for classifying my data set (Classification class: "class" 0/1). Here is what I do:</p>
  
  <pre><code>library(e1071)
  arrhythmia &lt;- read.csv(file="/home/.../arrhythmia.csv", head=TRUE, sep=",")
  
  #devide into training and test data 70:30
  trainingIndex &lt;- createDataPartition(arrhythmia$class, p=.7, list=F)
  arrhythmia.training &lt;- arrhythmia[trainingIndex,]
  arrhythmia.testing &lt;- arrhythmia[-trainingIndex,]
  
  nb.classifier &lt;- naiveBayes(class ~ ., data = arrhythmia.training)
  predict(nb.classifier,arrhythmia.testing[,-260])
  </code></pre>
  
  <p>The classifier does not work, here is what I get:</p>
  
  <pre><code>&gt; predict(nb.classifier,arrhythmia.testing[,-260])
  factor(0)
  Levels: 
  
  &gt; str(arrhythmia.training)
  'data.frame':   293 obs. of  260 variables:
   $ age                         : int  75 55 13 40 44 50 62 54 30 46 ...
   $ sex                         : int  0 0 0 1 0 1 0 1 0 1 ...
   $ height                      : int  190 175 169 160 168 167 170 172 170 158 ...
   $ weight                      : int  80 94 51 52 56 67 72 58 73 58 ...
   $ QRSduration                 : int  91 100 100 77 84 89 102 78 91 70 ...
   $ PRinterval                  : int  193 202 167 129 118 130 135 155 180 120 ...
   # and so on (260 attributes)
  
  &gt; str(arrhythmia.training[260])
  'data.frame':   293 obs. of  1 variable:
   $ class: int  1 0 1 0 0 1 1 1 1 0 ...
  
  
  &gt; nb.classifier$levels
  NULL
  </code></pre>
  
  <p>I tried to use the included the data set (iris) and everything works fine. 
  What's wrong with my approach?</p>