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
x <- c(15.1, 15.2, 15.3, 20.1, 20.2, 20.3)
over 6 seconds (each BPM is an average for that second), I'd like to interpret this as 2 heart rates per 6 seconds.