title: Group data by interval slice
body: <p>Let's say i have this kind of data:</p>
  
  <pre><code>&gt; head(data)
    year   type
  1 1999   A
  2 2018   B
  3 2002   A
  4 2001   B
  5 2017   B
  6 2017   A
  </code></pre>
  
  <p>How do i get to group the column 'year' by a interval defined by the user, let's say, <code>2</code>.</p>
  
  <p>So the returning data would look like this:</p>
  
  <pre><code>&gt; head(data)
     Ano       Type Freq
  1 1999-2000   A   12
  2 1999-2000   B   5
  3 2001-2002   A   23
  4 2001-2002   B   6
  5 2003-2004   A   30
  6 2003-2004   B   15
  </code></pre>
  
  <p>I'm using it along a <code>Shiny app</code>, and I've got this far, but it only works for one column:</p>
  
  <pre><code>period &lt;- 1999:2004
  
  n = 2
  interval = split(period, ceiling(seq_along(period) / n))
  year_interval = unlist(lapply(interval, function(x) {
    paste(min(x), max(x), sep = " - ")
  }))
  </code></pre>