I have an array of floating numbers and a certain cutoff:
myData = [1.3,1.5,1.7,1.7,16.7,18.4,19.2,19.5,19.6,20.2,20.8,58.4,60.7,
61.2,61.2,116.4,121.2,122.7,123.2,123.2,138.5,149.5,149.5]
myBin = 5.3
I'd like to build a hash of arrays so that the difference by subtraction between the last element and the first element of the array is less or equal to myBin (5.3)
myHash = {
'hap_1' => [1.3,1.5,1.7],
'hap_2' => [16.8, 18.4,19.2,19.5,19.6,20.2,20.8],
'hap_3' => [58.4,60.7,61.2,61.2],
'hap_4' => [116.4,121.2],
'hap_5' => [122.7,123.2,123.2],
'hap_6' => [138.5],
'hap_7' => [149.5,149.5]}
Thank you so much in advance for your time and helpful assistance. Cheers
snake_casefor variable names in Ruby.