title: stat_smooth - variable length differs
body: <p>I want to plot two variables against each other using ggplot. Later on I want to use a nonlinear fit, but I am having a problem with an error message I do not fully understand. I can see that others having similar problem, but I may not be bright enough to understand the answer</p>
  
  <p>I have a dataset ost containing 4 variables. There is no NA's in the dataset.</p>
  
  <p>using ggplot2 I want to plot the data with a regression line. For simplicity I start with the simple linear regression</p>
  
  <pre><code>library(ggplot2)
  
  qt_int &lt;- c(404, 402, 426, 392, 418, 410)
  rr &lt;- c(1000, 958, 982, 752, 824, 844)
  gender &lt;- c('male','female','female','female','female','female')
  deltnr &lt;- c(10445, 1022, 9122, 60, 246, 306)
  df = data.frame(deltnr, gender, qt_int, rr)   
  
  p &lt;- ggplot(df, aes(rr, qt_int))
  p &lt;- p + geom_point (size = 2)
  p &lt;- p + stat_smooth(method = "lm", formula = qt_int ~ rr)
  p
  </code></pre>
  
  <p>I get the following warning message:</p>
  
  <blockquote>
    <p>Warning messages: 1: 'newdata' had 80 rows but variables found have
    6702 rows  2: Computation failed in <code>stat_smooth()</code>: argumenter
    antyder forskelligt antal rækker: 80, 6 [En: arguments suggest
    different number of rows: 80, 6]</p>
  </blockquote>
  
  <p>Strangely enough it works if I omit formula (but I want later on to do nonlinear fit, so I have to get it to work)</p>
  
  <p>What am I missing?</p>