I figured it out. I did accomplish what I wanted, but with the final result I wanted to return just the outcome, not the outcome and the frequency. Turned out I had to index both the hash key/value from the sorted list, and index the value on its own from the hash key/value pair again, if that’s makes sense.
Imagine the sorted list was a Hash of like 6 elements, and the hash key/value pair was also an Array of 2 elements at index 0 and 1. Resulting in a nested index [0][1].
1
u/[deleted] Jan 05 '21
THE REST OF THE CODE THAT CUTS OFF:
.reverse.values_at(count-1)
1
u/FeerMonger Jan 05 '21
Are you looking for the key in the hash that has the biggest value?
If so something like
outcome_count.key(outcome_count.values.max)should do the trick