title: R ggplot2 getting "Error: Aesthetics must either be length one, or the same length as the dataProblems"
body: <p>I get na error</p>
  
  <pre><code>Error: Aesthetics must either be length one, or the same length as the dataProblems:Average, Average, Average
  </code></pre>
  
  <p>trying to put a vertical line in a picture with multiple horizontal boxplots</p>
  
  <p>Here is a piece of the data.frame gs1_domain, to draw boxplots is</p>
  
  <p><a href="https://i.stack.imgur.com/jAd5i.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jAd5i.png" alt="enter image description here"></a></p>
  
  <p>and here is the data.frame R_18, to put the vertical lines in the plots</p>
  
  <p><a href="https://i.stack.imgur.com/9OmOY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9OmOY.png" alt="enter image description here"></a></p>
  
  <p>Below is my code that draw the boxplots</p>
  
  <pre><code>bp_domain &lt;- ggplot(gs1_domain, aes(x=gs1_domain$Domain, y=gs1_domain$Average))
  bp_domain + stat_boxplot(geom='errorbar') + geom_boxplot(outlier.shape = 1) + 
    coord_flip() + xlab("Domínio") + ylab("Média") + ggtitle("Box plot das médias por domínios")
  </code></pre>
  
  <p>With this code I get the following graph</p>
  
  <p><a href="https://i.stack.imgur.com/a4ThO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/a4ThO.png" alt="enter image description here"></a></p>
  
  <p>I'm trying to put vertical lines in each boxplot, with data from the column <code>Average</code> in data.frame <code>R_18</code>.</p>
  
  <p>Now, following some <a href="http://www.cookbook-r.com/Graphs/Lines_%28ggplot2%29/" rel="nofollow noreferrer">google pages</a> I added to the code above the function geom_errorbar, and the new code is</p>
  
  <pre><code>bp_domain_R_18 &lt;- ggplot(gs1_domain, aes(x=gs1_domain$Domain, y=gs1_domain$Average))
  bp_domain_R_18 + stat_boxplot(geom='errorbar') + geom_boxplot(outlier.shape = 1) +
    geom_errorbar(data=R_18, aes(y=Average, ymax=Average, ymin=Average)) +
    coord_flip() + xlab("Domínio") + ylab("Média") + ggtitle("Box plot das médias por domínios")
  </code></pre>
  
  <p>but I get that error message.
  I already removed NA's from <code>gs1_domain</code>.</p>
  
  <p>Someone can tell me what's wrong?</p>