From: incag neato Date: 2012-09-18T02:29:20+09:00 Subject: Re: Breaking Down the Block Wow, so helpful. Thanks for taking so much of your time to explain. That must've taken at least an hour. Now, the one question I have left pertains to the following (the tied values (double mode)). ____________________________________ > 7stud -- wrote in post #1076263: > z = y.select {|a, b| b == y[0][1]} > p z > --output:-- > [[30, 2]] > In this example, the conditional b == y[0][1] is equivalent to b == 2. > If instead you had results like this, > [[10, 3], [30, 3], [20, 1], [40, 1]] > ...then the conditional would be b == 3, which just selects all the > numbers that tie for the most appearances in the original array. ____________________________________ How is "b == y[0][1]" similar to "b == 2" ? Do you mean the value in the sorted hash? When I call "top_count = nums_with_frequs[0][1]" am I referring to the first key and value in the sorted hash "freq_for" (i.e. the var "nums_with_frequs")? I've played around with it but I don't see how to use "b == 3" to arrive at the tied values. -- Posted via http://www.ruby-forum.com/.