title: Creating intervals of 5 seconds for data and grouping them
body: <p>I have a dataframe with one column being time and the other column being price. it looks like this</p>
  
  <pre><code>Time     | Price
  15:31:01 | 2
  15:31:03 | 4
  15:31:05 | 3
  15:31:08 | 1
  15:31:10 | 9
  </code></pre>
  
  <p>I would like to group the data in intervals of 5 seconds and take the average of each 5 seconds interval to look like this</p>
  
  <pre><code>Time     | Price
  15:31:05 | 4.5
  15:31:10 | 5
  </code></pre>
  
  <p>I know it is possible to do this via dplyr for grouping them in buckets of minutes where i extract the minute data for each row and then group them by minutes. But is there any way to do this for a custom second interval? In this case i am looking at 5 second interval.</p>