title: R - Left join based on the next largest value
body: <p>I am looking to join a table to my dataset based on between which 2 values it falls. It should preferably work within a dplyr pipe. The datasets look as follows:</p>
  <pre><code>data &lt;- data.frame(ID = c(01,02,03,04,05,06), result = c(0.33,0,-2.11,3.33,4.44,-7.1))
  key &lt;- data.frame(upper_value = c(-4,-1,1,4,10), points = c(0,1,2,3,4))
  </code></pre>
  <p>The lowest value of <em>result</em> can be 10, but as I am searching for next largest (or equal) value, it is not mentioned in the <em>key</em> dataset.</p>
  <p>Take note that the results do not have to be integers.</p>
  <p>The expected result looks like this:</p>
  <pre><code>expected &lt;- data.frame(ID = c(01,02,03,04,05,06), result = c(0.3333,0,-2.11,3.3333,4.44,-7.1), c(2,2,1,3,4,0))
  </code></pre>