title: R ggplot - Error stat_bin requires continuous x variable
body: <p>My table is data.combined with following structure:</p>
  
  <pre><code>'data.frame':   1309 obs. of  12 variables:
   $ Survived: Factor w/ 3 levels "0","1","None": 1 2 2 2 1 1 1 1 2 2 ...
   $ Pclass  : Factor w/ 3 levels "1","2","3": 3 1 3 1 3 3 1 3 3 2 ...
   $ Name    : Factor w/ 1307 levels "Abbing, Mr. Anthony",..: 109 191 358 277 16 559 520 629 417 581 ...
   $ Sex     : num  2 1 1 1 2 2 2 2 1 1 ...
   $ Age     : num  22 38 26 35 35 NA 54 2 27 14 ...
   $ SibSp   : int  1 1 0 1 0 0 0 3 0 1 ...
   $ Parch   : int  0 0 0 0 0 0 0 1 2 0 ...
   $ Ticket  : Factor w/ 929 levels "110152","110413",..: 524 597 670 50 473 276 86 396 345 133 ...
   $ Fare    : num  7.25 71.28 7.92 53.1 8.05 ...
   $ Cabin   : Factor w/ 187 levels "","A10","A14",..: 1 83 1 57 1 1 131 1 1 1 ...
   $ Embarked: Factor w/ 4 levels "","C","Q","S": 4 2 4 4 4 3 4 4 4 2 ...
   $ Title   : Factor w/ 4 levels "Master.","Miss.",..: 3 3 2 3 3 3 3 1 3 3 ...
  </code></pre>
  
  <p>I want to draw a graph to reflect the relationship between Title and Survived, categorized by Pclass. I used the following code:</p>
  
  <pre><code>  ggplot(data.combined[1:891,], aes(x=Title, fill = Survived)) +
    geom_histogram(binwidth = 0.5) +
    facet_wrap(~Pclass) +
    ggtitle ("Pclass") +
    xlab("Title") +
    ylab("Total count") +
    labs(fill = "Survived")
  </code></pre>
  
  <p>However this results in error: <code>Error: StatBin requires a continuous x variable the x variable is discrete. Perhaps you want stat="count"?</code></p>
  
  <p>If I change variable Title into numeric: <code>data.combined$Title &lt;- as.numeric(data.combined$Title)</code> then the code works but the label in the graph is also numeric (below). Please tell me why it happens and how to fix it. Thanks.</p>
  
  <p>Btw, I use R 3.2.3 on Mac El Capital.</p>
  
  <p>Graph: Instead of Mr, Miss,Mrs the x axis shows numeric values 1,2,3,4</p>
  
  <p><a href="https://i.stack.imgur.com/CbWeS.png" rel="noreferrer"><img src="https://i.stack.imgur.com/CbWeS.png" alt="enter image description here"></a></p>