title: R: Group by data every N months
body: <p>I have data from 2016-01-01 to 2017-07-30. I want to group_by data every three months and summarize. It's hard to show the entire data since it won't fit here. I generally use <code>lubridate</code> and <code>dplyr</code> for data manipulation but I am unable to figure out how to roll up data every three months. The pseudo code of what I am trying to accomplish is as below:</p>
  
  <pre><code>df$month &lt;- month(as.Date(df$date))
  df$year &lt;- year(as.Date(df$date))
  df %&gt;% group_by(month + "3 Months", year) %&gt;% summarise(n = sum(pageviews))
  </code></pre>
  
  <p>Can you please suggest me a simple way to do this? I know it's very simple using <code>dplyr</code>. Thanks a lot in advance. </p>