<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Oct 20, 2011, at 9:22 AM, Dylan Beaudette wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">The neat thing about GRASS and other OSS, you can always take a peak at the<span class="Apple-converted-space"> </span><br>source code. From my basic understanding of C, I don't think that there is<span class="Apple-converted-space"> </span><br>anything here that would accommodate ties-- so the result of<span class="Apple-converted-space"> </span><br>mode(4,4,4,4,5,5,5,5) would probably be 4 -- as it comes first. This is the<span class="Apple-converted-space"> </span><br>behavior in R when using something like which.max(table(x)).</span></blockquote></div><br><div>Thanks for the reply Dylan. As I read through the code you pasted, it looks to me that as the variable 'values' gets counted, then in the case of a tie, such as this 2 x 2 matrix </div><div><br></div><div>_____</div><div>| 4 | 5 |</div><div>_____</div><div>| 4 | 5 |</div><div>_____</div><div><br></div><div>would yield a mode result of 4 with the logic that the tie goes to the smallest value in sorted list of values? In this case... 4 4 5 5 = mode of 4, where as a sorted list such as 1 2 3 4 would yield a mode of 1? </div><div><br></div><div>Is that right? </div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></body></html>