title: Plot rollapply with ggplot in R
body: <p>I need help. I want to plot a barplot with the package ggplot that represents the rollapply(vector, 2, FUN= "mean"). I want that the plot looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/eSf8C.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eSf8C.jpg" alt="enter image description here"></a></p>
  
  <p>But the bars have to represent the "rollmeans". The code that I have used for do this plot is:</p>
  
  <pre><code>    ggplot(bp12.0.5op, 
         aes(fecha,part.0.5))+
    geom_point(na.rm=TRUE, color="firebrick")+
    geom_line(color="firebrick", size=1)+
    stat_summary_bin(fun.y="mean", geom="bar")+
    geom_smooth(method = "loess", se = FALSE, linetype = 1, color = "black", size = 1 )+  
    geom_hline(yintercept = 15000000)+
    annotate("text", min(bp12.0.5op$fecha), 15500000, label = "Límite")+
    ggtitle("PARTÍCULAS DE 0,5micras EN SALA LLENADO BP12 OPERATIONAL")
    geom_line(rollapply(bp12.0.5op, width = 10, FUN = mean), col = 'red')
  </code></pre>
  
  <p>Thanks!</p>