title: Adding confidence intervals ggplot
body: <p>I want to plot intervals of confidence of fitted values. I read some post related, but I am still stuck..These are a sample of the date: </p>
  
  <pre><code>pd &lt;-structure(list(date = 1:5, obs = c(44.6651011845397, 62.3441339250369, 
            52.8968240161506, 51.7795930633478, 63.1284636561025), pred = c(47.2643891039645, 
            55.7996450577325, 52.9566469533233, 51.3393289316, 59.0011440099732)), 
            .Names = c("date", "obs", "pred"), row.names = c(NA, 5L), class = "data.frame")
  
  pd2 &lt;- structure(list(date = 1:5, lwr = c(44.8529592578518, 54.9926370476338, 
           51.7358955911624, 49.401869166722, 58.1674619447108), upr = c(49.6758189500772, 
           56.6066530678312, 54.1773983154842, 53.2767886964779, 59.8348260752356
            )), .Names = c("date", "lwr", "upr"), row.names = c(NA, 5L), class = "data.frame")
  
  dd  &lt;-  melt(pd, id=c("date"))   #Data
  dd2 &lt;- melt(pd2,id=c("date"))    #Intervals of conf.
  p &lt;- ggplot(dd) + geom_line(aes(x=date, y=value, colour=variable)) 
  p &lt;- p + geom_smooth(aes(x=date, y=value, ymax=lwr, ymin=upr), #1 way
              colour='grey', data=dd2, stat='identity')
  </code></pre>
  
  <p>Also tried...</p>
  
  <p>#  p+ geom_ribbon(data=dd2,aes(ymin=lwr,ymax=upr),alpha=0.3)      #2.</p>
  
  <p>I received the error:
  <code>Error in eval(expr, envir, enclos) : object 'lwr' not found</code> ....what am I missing?</p>
  
  <p>I also tried to do it without using <code>melt</code> ... but then I also had problems with the legend!</p>