title: using intervals to assign categorical values
body: <p>Take the following generic data</p>
  
  <pre><code>A &lt;- c(5,7,11,10,23,30,24,6)
  B &lt;- c(1,2,3,1,2,3,1,2)
  C &lt;- data.frame(A,B)
  </code></pre>
  
  <p>and the following intervals</p>
  
  <pre><code>library(intervals)
  interval1 &lt;- Intervals(
    matrix(
      c(
        5, 15,
        15, 25,
        25, 35,
        35, 100
      ),
      ncol = 2, byrow = TRUE
    ),
    closed = c( TRUE, FALSE ),
    type = "Z"
  )
  rownames(interval1) &lt;- c("A","B","C", "D")
  
  interval2 &lt;- Intervals(
    matrix(
      c(
        0, 10,
        12, 20,
        22, 30,
        30, 100
      ),
      ncol = 2, byrow = TRUE
    ),
    closed = c( TRUE, FALSE ),
    type = "Z"
  )
  rownames(interval2) &lt;- c("P","Q","R", "S")
  </code></pre>
  
  <p>Now I want to create the following output table</p>
  
  <p><img src="https://i.stack.imgur.com/MrySW.png" alt="enter image description here"></p>
  
  <p>So where the A value overlap the two invervals, I want to 'copy' all the data to a line below.
  We also introduce <code>data$X</code> which is the <code>interval1</code> value and <code>data$y</code> which is the <code>interval2</code> value.
  Where data does not fit within any of the interval, I want to remove it from the data.frame</p>
  
  <p>I am not sure if the <code>break()</code> function would be better used to create the intervals or if the <code>dplyr</code> function can be used to make the reoccuring data rows</p>