title: Binning values in a vector
body: <p>I'm trying to 'bin' numbers which are beats per minute (BPM) into heart rate; the number of BPMs per time. I'm trying to keep the most similar consecutive numbers together as 1 heart rate. For example, if the BPM was </p>
  
  <pre><code>x &lt;- c(15.1, 15.2, 15.3, 20.1, 20.2, 20.3)
  </code></pre>
  
  <p>over 6 seconds (each BPM is an average for that second), I'd like to interpret this as 2 heart rates per 6 seconds. </p>